amkyawdev-nlp / README.md
openhands
Enhance: Professional README with badges, TOC, and documentation
8bad5af

A newer version of the Gradio SDK is available: 6.17.3

Upgrade
metadata
title: Amkyaw AI NLP
emoji: ๐Ÿค–
colorFrom: blue
colorTo: gray
sdk: gradio
sdk_version: 5.29.0
python_version: '3.12'
app_file: app.py
pinned: false
license: mit
tags:
  - chatbot
  - myanmar
  - burmese
  - nlp
  - llama
  - groq
  - llm
  - conversational-ai
  - local-ai
Amkyaw AI Badge

๐Ÿค– Amkyaw AI NLP

แ€™แ€ผแ€”แ€บแ€™แ€ฌแ€…แ€ฌ AI Chatbot - Powered by Groq & Llama 3.1

License: MIT Python: 3.12 Gradio: 5.29.0 Spaces Model: Llama-3.1-8b

Try it on HuggingFace Spaces Live Demo


๐Ÿ“– Table of Contents


๐Ÿ“ Overview

Amkyaw AI NLP is a sophisticated conversational AI chatbot specifically designed for Myanmar (Burmese) language interactions. The system combines local knowledge base matching with advanced LLM capabilities to provide intelligent, contextually appropriate responses in Myanmar Unicode text.

๐ŸŽฏ Core Objectives

  • โœ… Provide natural conversational experiences in Myanmar language
  • โœ… Leverage local dataset for accurate responses to common queries
  • โœ… Utilize Groq-powered Llama 3.1 for complex reasoning tasks
  • โœ… Demonstrate production-grade AI chatbot architecture

โœจ Features

Feature Description
๐Ÿ—ฃ๏ธ Myanmar Language Support Full Unicode support for Burmese text input and output
๐Ÿ” Intelligent Matching Fuzzy search with 85% similarity threshold
โšก Groq Integration High-performance inference with Llama 3.1 8B
๐ŸŽจ Modern UI Dark-themed Gradio interface
๐Ÿ”„ Streaming Responses Real-time token-by-token output
๐Ÿ“š Extensible Knowledge CSV-based conversation database
๐Ÿ›ก๏ธ Error Handling Graceful fallback responses

๐Ÿ› ๏ธ Technology Stack

Core Technologies

Technology Version Purpose
Python 3.12+ Runtime environment
Gradio 5.29.0 Web UI framework
Groq Latest LLM inference engine
Pandas Latest Data processing

AI/ML Libraries

Library Purpose
Llama 3.1 8B Instant Large language model
SequenceMatcher Fuzzy string matching

โš™๏ธ How It Works

Architecture Flow

User Input โ†’ Fuzzy Match Check โ†’ [Match Found?] โ†’ Yes โ†’ Return Local Response
                     โ†“ No
              Groq API (Llama 3.1) โ†’ Process โ†’ Streaming Response

Response Logic

Step 1: Local Knowledge Base

  • System loads conversation pairs from CSV dataset
  • Implements fuzzy matching with SequenceMatcher
  • Returns matching response if similarity > 85%

Step 2: LLM Fallback

  • For unmatched queries, uses Groq API
  • Converts chat history to Llama format
  • Generates contextual response

๐Ÿ“ Project Structure

amkyawdev-nlp/
โ”œโ”€โ”€ app.py                    # Main Gradio application
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ README.md               # This file
โ”œโ”€โ”€ LICENSE                # MIT License
โ”œโ”€โ”€ .gitignore             # Git ignore rules
โ””โ”€โ”€ .gradioignore          # Gradio ignore rules

File Descriptions

File Description
app.py Core application with UI and AI logic
requirements.txt pip dependencies
README.md Documentation
LICENSE MIT License

๐Ÿš€ Installation

Prerequisites

  • Python 3.12+
  • pip (ๅŒ…็ฎก็†ๅ™จ)

Local Setup

# Clone the repository
git clone https://huggingface.co/spaces/amkyawdev/amkyawdev-nlp.git
cd amkyawdev-nlp

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/macOS
# venv\Scripts\activate  # Windows

# Install dependencies
pip install -r requirements.txt

# Set environment variable
export GROQ_API_KEY=your_api_key_here

# Run the application
python app.py

Docker Deployment

FROM python:3.12-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY app.py .
EXPOSE 7860

CMD ["python", "app.py", "--share"]

๐Ÿ’ป Usage

Running Locally

# Set your Groq API key
export GROQ_API_KEY=your_key_here

# Launch the app
python app.py

The app will be available at http://localhost:7860

Using on HuggingFace Spaces

Visit: https://amkyawdev-amkyawdev-nlp.hf.space

API Example

import requests

response = requests.post(
    "https://amkyawdev-amkyawdev-nlp.hf.space/predict",
    json={"data": ["แ€Ÿแ€ฑแ€ฌแ€€แ€บแ€•แ€”แ€บแ€ธแ€•แ€ซ"]}
)
print(response.json())

๐Ÿ” Environment Variables

Variable Required Description
GROQ_API_KEY Yes Groq API authentication token

Getting Your Groq API Key

  1. Visit console.groq.com
  2. Create an account or sign in
  3. Navigate to API Keys
  4. Generate new key
  5. Copy and set as environment variable

๐Ÿ“ฆ Deployment

HuggingFace Spaces

This app is optimized for HF Spaces deployment:

# HF Spaces automatically handles:
# - Container management
# - HTTPS enforcement
# - Traffic distribution
# - Sleep scheduling (after 48h inactivity)

Environment Details

Setting Value
Runtime Gradio 5.29.0
Python 3.12
Hardware CPU Basic
Sleep Time 48 hours

๐Ÿ”’ Security

Best Practices Implemented

  • โœ… API keys stored as secrets (not in code)
  • โœ… HTTPS enforced by Spaces
  • โœ… Input validation
  • โœ… Error message localization
  • โœ… Rate limiting (via Spaces)

Recommendations

  • Never commit API keys to version control
  • Rotate keys periodically
  • Monitor usage in Groq dashboard

๐Ÿ“œ License

MIT License

Copyright (c) 2024 amkyawdev

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


๐Ÿ“ง Contact

amkyawdev

HuggingFace Profile

๐Ÿค Acknowledgments


โญ If you find this project useful, please consider giving it a star!