File size: 2,278 Bytes
b76224d
 
 
 
 
 
 
 
 
 
 
 
2f38e4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Nuera
emoji: πŸ“š
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.19.0
app_file: app.py
pinned: false
---

Check out the configuration reference at https://huggingface.co./docs/hub/spaces-config-reference
# My AI Models Space

This Hugging Face Space hosts TTS, SST, and LLM models with API endpoints.

## Setup

1. **Clone the repository** to your Hugging Face Space.
2. **Install dependencies**: `pip install -r requirements.txt`.
3. **Prepare models**:
   - **TTS**: Run `download_and_finetune_tts.py` externally, then upload `./tts_finetuned` to `models/tts_model`. If not uploaded, uses `parler-tts/parler-tts-mini-v1`.
   - **SST**: Run `download_and_finetune_sst.py` externally, then upload `./sst_finetuned` to `models/sst_model`. If not uploaded, uses `facebook/wav2vec2-base-960h`.
   - **LLM**: Download a Llama GGUF file (e.g., from `TheBloke/Llama-2-7B-GGUF` on Hugging Face Hub) and upload to `models/llama.gguf`. Required for LLM to work.
4. **Deploy**: Push to your Space, and it will run `app.py`.

## API Endpoints

- **POST /tts**
  - **Request**: `{"text": "Your text here"}`
  - **Response**: Audio file (WAV)
  - **Example**: `curl -X POST -H "Content-Type: application/json" -d '{"text":"Hello"}' http://your-space.hf.space/tts --output output.wav`

- **POST /sst**
  - **Request**: Audio file upload
  - **Response**: `{"text": "transcribed text"}`
  - **Example**: `curl -X POST -F "[email protected]" http://your-space.hf.space/sst`

- **POST /llm**
  - **Request**: `{"prompt": "Your prompt here"}`
  - **Response**: `{"text": "generated text"}`
  - **Example**: `curl -X POST -H "Content-Type: application/json" -d '{"prompt":"Tell me a story"}' http://your-space.hf.space/llm`

## Fine-Tuning

- **TTS**: Edit `download_and_finetune_tts.py` with your dataset, run externally, and upload the result.
- **SST**: Edit `download_and_finetune_sst.py` with your dataset, run externally, and upload the result.
- **LLM**: Llama.cpp is used for inference only. For fine-tuning, use tools like LoRA with Transformers externally, convert to GGUF, and upload.

## Notes

- Ensure GGUF file for LLM is manageable (e.g., quantized versions like `llama-2-7b.Q4_K_M.gguf`).
- Fine-tuning requires significant resources; perform it outside Spaces.