A local, privacy-friendly chatbot web app powered by Qwen2.5-0.5B-Instruct, built with Gradio for the UI. Chat with the model entirely on your own machine — no external API calls, no data leaving your system.
- Runs locally — powered by the lightweight
Qwen2.5-0.5B-Instructmodel, no internet connection required at inference time. - Clean chat interface with a dark theme, message input box, file attachment, and voice recording support.
- Conversation history sidebar — start a New Chat, revisit past conversations, or delete selected ones.
- Quick-start prompts — suggested starter messages ("Hello!", "What is Python?", "Tell me a joke") to get the conversation going instantly.
- Code-aware responses — the model can generate and explain code (e.g. Gradio app examples) with syntax-highlighted code blocks and a copy button.
- Built with Gradio, exposing both a web UI and an API endpoint (
Use via API).
Landing screen with quick-start suggestions: The home screen greets users with the "Local Qwen Chatbot" header, model info, and a set of clickable example prompts to begin chatting.
Live conversation example: Asking the bot "give a gradio code" returns a full explanation along with a working, syntax-highlighted Python code snippet using the Gradio library.
CHATBOT/
├── Qwen2.5-0.5B-Instruct/ # Local model files/weights
├── .gitignore # Files/folders excluded from git
├── chat_history.json # Stored conversation history
├── chat.py # Core chat logic (message handling, model calls)
├── config.py # App configuration and settings
├── history.py # Logic for loading/saving/managing chat history
├── main.py # Application entry point
├── model.py # Model loading and inference logic
└── ui.py # Gradio UI layout and components
| File | Purpose |
|---|---|
main.py |
Entry point — launches the Gradio app. |
ui.py |
Defines the Gradio interface: chat window, sidebar, buttons, and layout. |
chat.py |
Handles sending/receiving messages and coordinating responses. |
model.py |
Loads Qwen2.5-0.5B-Instruct and runs inference to generate replies. |
history.py |
Manages conversation history (create, load, delete chats). |
config.py |
Centralized configuration (model name, paths, settings). |
chat_history.json |
Persisted storage of past conversations. |
Qwen2.5-0.5B-Instruct/ |
Local directory containing the downloaded model weights. |
- Python 3.x
gradiotransformers(or equivalent library used to load the Qwen model)- The
Qwen2.5-0.5B-Instructmodel weights downloaded locally
git clone https://github.com/Mah6od/chatbot-gradio.git
cd CHATBOT
pip install -r requirements.txtpython main.pyThen open the local URL shown in your terminal (Gradio will print something like http://127.0.0.1:7860).
- Launch the app with
python main.py. - Type a message in the input box, or click one of the suggested starter prompts.
- Use New Chat to start a fresh conversation.
- Access past conversations from the History sidebar; select and Delete selected to remove ones you no longer need.
- Use the attachment icon to send files, or the microphone icon to record voice input.
- Gradio — for the web-based chat interface
- Qwen2.5-0.5B-Instruct — the underlying language model

