Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,11 +4,14 @@ from transformers import pipeline
|
|
| 4 |
from sentence_transformers import SentenceTransformer
|
| 5 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 6 |
import PyPDF2
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Load local models for inference
|
| 9 |
stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
| 10 |
conversation_model = pipeline("text-generation", model="facebook/blenderbot-400M-distill")
|
| 11 |
-
tts_model = pipeline("text-to-speech", model="espnet/fastspeech2-en-ljspeech")
|
| 12 |
|
| 13 |
# Load a pre-trained model for vector embeddings
|
| 14 |
embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
@@ -47,9 +50,10 @@ def generate_question(user_input, resume_embeddings):
|
|
| 47 |
|
| 48 |
# Generate TTS output
|
| 49 |
def generate_audio(text):
|
| 50 |
-
"""Convert text to audio using TTS model."""
|
| 51 |
-
|
| 52 |
-
return
|
|
|
|
| 53 |
|
| 54 |
# Gradio interface
|
| 55 |
class MockInterview:
|
|
|
|
| 4 |
from sentence_transformers import SentenceTransformer
|
| 5 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 6 |
import PyPDF2
|
| 7 |
+
from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
|
| 8 |
+
|
| 9 |
+
# Load models for TTS from Hugging Face Hub
|
| 10 |
+
models, cfg, task = load_model_ensemble_and_task_from_hf_hub("facebook/fastspeech2-en-ljspeech")
|
| 11 |
|
| 12 |
# Load local models for inference
|
| 13 |
stt_model = pipeline("automatic-speech-recognition", model="openai/whisper-base")
|
| 14 |
conversation_model = pipeline("text-generation", model="facebook/blenderbot-400M-distill")
|
|
|
|
| 15 |
|
| 16 |
# Load a pre-trained model for vector embeddings
|
| 17 |
embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
|
|
|
|
| 50 |
|
| 51 |
# Generate TTS output
|
| 52 |
def generate_audio(text):
|
| 53 |
+
"""Convert text to audio using Fairseq TTS model."""
|
| 54 |
+
# Here you can integrate model-specific logic to produce audio from text
|
| 55 |
+
# Placeholder return until Fairseq TTS model logic is implemented
|
| 56 |
+
return text # Replace with actual waveform generation
|
| 57 |
|
| 58 |
# Gradio interface
|
| 59 |
class MockInterview:
|