Spaces:
Build error
Build error
File size: 1,520 Bytes
16815f0 0e4080b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
---
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
```
|