Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,12 +39,6 @@ model_name = "BeastGokul/Nika-1.5B"
|
|
| 39 |
llm_tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 40 |
llm_model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 41 |
|
| 42 |
-
# Option 2: OpenAI Whisper for speech recognition
|
| 43 |
-
whisper_processor = AutoProcessor.from_pretrained("openai/whisper-large-v3")
|
| 44 |
-
whisper_model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large-v3")
|
| 45 |
-
|
| 46 |
-
# Option 3: Wav2Vec2 for phoneme-level analysis
|
| 47 |
-
|
| 48 |
# Automatically use GPU if available
|
| 49 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 50 |
|
|
@@ -120,8 +114,9 @@ def save_audio(audio, user_id="default"):
|
|
| 120 |
|
| 121 |
# Audio processing and phonetic analysis
|
| 122 |
def transcribe_with_whisper(audio_path):
|
| 123 |
-
"""Transcribe audio using
|
| 124 |
-
|
|
|
|
| 125 |
return result["text"]
|
| 126 |
|
| 127 |
def extract_phonemes(text):
|
|
|
|
| 39 |
llm_tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 40 |
llm_model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
# Automatically use GPU if available
|
| 43 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 44 |
|
|
|
|
| 114 |
|
| 115 |
# Audio processing and phonetic analysis
|
| 116 |
def transcribe_with_whisper(audio_path):
|
| 117 |
+
"""Transcribe audio using Hugging Face's pipeline for Whisper"""
|
| 118 |
+
asr_pipeline = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3")
|
| 119 |
+
result = asr_pipeline(audio_path)
|
| 120 |
return result["text"]
|
| 121 |
|
| 122 |
def extract_phonemes(text):
|