zsolnai commited on
Commit
17fc0b1
·
1 Parent(s): 8ab84e9

Add gradeio app

Browse files
Files changed (2) hide show
  1. app.py +8 -15
  2. requirements.txt +0 -1
app.py CHANGED
@@ -5,8 +5,7 @@ import gradio as gr
5
  import numpy as np
6
  import soundfile as sf
7
  import torch
8
- from huggingface_hub import hf_hub_download
9
- from llama_cpp import Llama
10
  from transformers import pipeline
11
  from TTS.api import TTS
12
 
@@ -18,19 +17,13 @@ print("Loading Whisper...")
18
  STT_MODEL_NAME = "openai/whisper-tiny.en"
19
  stt_pipe = pipeline("automatic-speech-recognition", model=STT_MODEL_NAME, device=device)
20
 
21
- # --- 2. LLM Setup (YOUR GGUF MODEL) ---
22
- print("Downloading and loading your GGUF model...")
23
-
24
- # Download your specific model file
25
- model_path = hf_hub_download(repo_id="gzsol/model_1b", filename="model-Q8_0.gguf")
26
-
27
- # Initialize Llama-cpp (Optimized for CPU)
28
- llm = Llama(
29
- model_path=model_path,
30
- n_ctx=2048, # Context window
31
- n_threads=2, # CPU threads
32
- verbose=False,
33
- )
34
 
35
  # --- 3. TTS Setup (Coqui) ---
36
  print("Loading TTS...")
 
5
  import numpy as np
6
  import soundfile as sf
7
  import torch
8
+ from huggingface_hub import InferenceClient
 
9
  from transformers import pipeline
10
  from TTS.api import TTS
11
 
 
17
  STT_MODEL_NAME = "openai/whisper-tiny.en"
18
  stt_pipe = pipeline("automatic-speech-recognition", model=STT_MODEL_NAME, device=device)
19
 
20
+ # --- 2. LLM Setup (HuggingFace Inference API) ---
21
+ print("Setting up HuggingFace Inference API...")
22
+ HF_API_TOKEN = os.getenv("HF_TOKEN")
23
+ if not HF_API_TOKEN:
24
+ print("Warning: HF_TOKEN not set. Set it as a secret in HF Spaces.")
25
+ llm_client = InferenceClient(token=HF_API_TOKEN)
26
+ LLM_MODEL = "gzsol/model_1b"
 
 
 
 
 
 
27
 
28
  # --- 3. TTS Setup (Coqui) ---
29
  print("Loading TTS...")
requirements.txt CHANGED
@@ -5,4 +5,3 @@ TTS
5
  soundfile
6
  numpy
7
  huggingface-hub
8
- llama-cpp-python
 
5
  soundfile
6
  numpy
7
  huggingface-hub