Skip to content

bghM/Huggingface-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Arabic Chatbot with Mistral-7B

This project implements an Arabic chatbot using the Mistral-7B language model. It consists of a FastAPI backend server that handles chat interactions and a Next.js frontend for the user interface.

Features

  • Arabic language responses using Mistral-7B model
  • FastAPI backend with efficient model loading
  • Next.js frontend with modern UI
  • Real-time chat interactions

Setup

Backend

  1. Install Python dependencies:
cd python-backend
pip install -r requirements.txt
  1. Download the Mistral-7B model:
curl -L https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf -o models/mistral-7b-instruct-v0.2.Q4_K_M.gguf
  1. Run the server:
uvicorn server:app --host 0.0.0.0 --port 8000

Frontend

  1. Install Node.js dependencies:
npm install
  1. Run the development server:
npm run dev

API Endpoints

  • GET /: Health check endpoint
  • GET /health: Model status check endpoint
  • POST /chat: Chat endpoint for sending messages and receiving responses

Project Structure

.
โ”œโ”€โ”€ python-backend/
โ”‚   โ”œโ”€โ”€ models/           # Directory for model files
โ”‚   โ””โ”€โ”€ server.py        # FastAPI server implementation
โ”œโ”€โ”€ src/                 # Next.js frontend source code
โ”œโ”€โ”€ public/             # Static assets
โ””โ”€โ”€ README.md           # Project documentation

Note

The Mistral-7B model file is large and not included in the repository. Please download it separately using the curl command provided in the setup instructions.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

  1. โœ… Updated Scope for Seirah Chatbot ๐ŸŽฏ Purpose The chatbot will: โ€ข Help users with CV creation using Seirah โ€ข Resolve common Seirah.com platform issues

  2. ๐Ÿ” Examples of User Data Privacy Concerns These define what your chatbot should not store, log, or expose: Concern | Example โŒ Storing sensitive data | CV content, phone numbers, emails unless needed temporarily โŒ Exposing private info in responses | Revealing another user's CV if mistakenly queried โœ… Data minimization | Only use/return what's necessary per question โœ… GDPR/CCPA compliance | Optional: include opt-in logs, data deletion support

โœ… Recommendation: Add clear instructions: "This chatbot does not store or retain any of your private CV data."

  1. ๐Ÿ”— Example Platform Integrations to Consider Use Case Integration Save generated CV Connect chatbot to Seirah's CV API or Firebase Upload/edit info Let chatbot update user profile or experience Export formats Chatbot offers PDF, DOCX export links Analytics Log usage to PostHog or internal metrics platform Live fallback If chatbot can't help, escalate to human (Zendesk, Intercom, etc.)

  2. โœ… Next Step

  3. Generate an enhanced seirah.txt mock file based on real Seirah user data and issues

  4. Enable Arabic/English response selection automatically based on input

  5. Set up the LangChain backend with history and language support

  6. Add conversation memory (multi-turn) 5โ€ข Support Arabic/English auto-response 6โ€ข Return simplified output (only the reply text)

  7. Test code: From the backend: curl -X POST http://localhost:8000/chat
    -H "Content-Type: application/json"
    -d '{"message": "ูƒูŠู ุฃู†ุดุฆ ุณูŠุฑุฉ ุฐุงุชูŠุฉุŸ"}'

From the frontend: ูƒูŠู ุฃู†ุดุฆ ุณูŠุฑุฉ ุฐุงุชูŠุฉุŸ"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages