Spaces:
Build error
Build error
title: Gemma AI Assistant | |
emoji: 🤖 | |
colorFrom: indigo | |
colorTo: purple | |
sdk: docker | |
sdk_version: "1.0" | |
app_file: app.py | |
pinned: false | |
# Gemma AI Assistant Space | |
This Space hosts the backend API for the Gemma AI Assistant, a conversational AI that combines local LLM processing using HuggingFace Transformers and real-time chat capabilities with Google's Gemini API. | |
## Features | |
- FastAPI backend with async support | |
- Local LLM using `mradermacher/Huihui-gemma-3n-E4B-it-abliterated-GGUF` | |
- Gemini API integration for real-time chat | |
- Supabase integration for data persistence | |
- Containerized deployment | |
## API Endpoints | |
### POST /api/chat | |
Process chat messages using either the local LLM or Gemini API. | |
**Request Body:** | |
```json | |
{ | |
"messages": [ | |
{ | |
"role": "user", | |
"content": "Hello, how are you?" | |
} | |
], | |
"use_gemini": true, | |
"temperature": 0.7 | |
} | |
``` | |
**Response:** | |
```json | |
{ | |
"response": "I'm doing well, thank you! How can I help you today?" | |
} | |
``` | |
## Environment Variables Required | |
- `GOOGLE_AI_STUDIO_KEY`: Your Google AI Studio API key | |
- `SUPABASE_URL`: Your Supabase project URL | |
- `SUPABASE_SERVICE_KEY`: Your Supabase service role key | |
- `HF_MODEL_ID`: HuggingFace model ID (default: mradermacher/Huihui-gemma-3n-E4B-it-abliterated-GGUF) | |
## Local Development | |
1. Install dependencies: | |
```bash | |
pip install -r requirements.txt | |
``` | |
2. Run the server: | |
```bash | |
uvicorn app:app --reload --port 7860 | |
``` | |
## Testing | |
Run the tests using pytest: | |
```bash | |
pytest test_app.py -v | |
``` | |