Campusmind-AI / README.md
aazankhanYousafzai's picture
Upload 3 files
6694f06 verified
# ⚑ Groq Chatbot β€” Streamlit App
A fast, free AI chatbot powered by [Groq](https://console.groq.com) and deployed with [Streamlit](https://streamlit.io).
## Features
- πŸ†“ Free Groq API (no credit card)
- ⚑ Blazing fast LLaMA / Mixtral inference
- 🎭 5 built-in personas + custom system prompt
- πŸ”„ Switch models mid-conversation
- πŸ’Ύ Export conversation as JSON
- πŸŒ™ Dark theme UI
---
## Run Locally
```bash
# 1. Clone
git clone https://github.com/YOUR_USERNAME/groq-chatbot.git
cd groq-chatbot
# 2. Install
pip install -r requirements.txt
# 3. Set API key (get free at console.groq.com)
export GROQ_API_KEY="gsk_..."
# 4. Run
streamlit run app.py
```
App opens at **http://localhost:8501**
---
## Deploy to Streamlit Cloud (Free)
1. Push this repo to GitHub
2. Go to [share.streamlit.io](https://share.streamlit.io) β†’ **New app**
3. Select your repo and set **Main file path** to `app.py`
4. Click **Advanced settings β†’ Secrets** and add:
```toml
GROQ_API_KEY = "gsk_your_key_here"
```
5. Click **Deploy** β€” live URL in ~2 minutes βœ…
---
## File Structure
```
groq-chatbot/
β”œβ”€β”€ app.py ← Streamlit UI
β”œβ”€β”€ chatbot.py ← Groq API logic
β”œβ”€β”€ requirements.txt ← Dependencies
β”œβ”€β”€ .streamlit/
β”‚ β”œβ”€β”€ config.toml ← Theme settings
β”‚ └── secrets.toml ← API key (local only, gitignored)
β”œβ”€β”€ .gitignore
└── README.md
```
---
## Customise
**Add a new persona** β€” in `app.py`, add to the `personas` dict:
```python
"πŸ§‘β€βš•οΈ Doctor": "You are a medical assistant. Always recommend consulting a real doctor."
```
**Change default model** β€” in `chatbot.py`:
```python
DEFAULT_MODEL = "llama-3.1-8b-instant" # fastest
```
**Longer memory** β€” in `chatbot.py`:
```python
MAX_HISTORY_TURNS = 40
```