Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,10 +12,12 @@ if token:
|
|
| 12 |
else:
|
| 13 |
raise ValueError("El token de Hugging Face no está configurado en las variables de entorno.")
|
| 14 |
|
|
|
|
|
|
|
| 15 |
# Cargar el modelo
|
| 16 |
repo_name = "HugoZeballos/rapa_nui_asr_2" # Ajusta al nombre de tu modelo en Hugging Face
|
| 17 |
processor = Speech2TextProcessor.from_pretrained(repo_name)
|
| 18 |
-
model = Speech2TextForConditionalGeneration.from_pretrained(repo_name).to(
|
| 19 |
|
| 20 |
def transcribe(audio_path):
|
| 21 |
audio, sr = librosa.load(audio_path, sr=16000)
|
|
|
|
| 12 |
else:
|
| 13 |
raise ValueError("El token de Hugging Face no está configurado en las variables de entorno.")
|
| 14 |
|
| 15 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 16 |
+
|
| 17 |
# Cargar el modelo
|
| 18 |
repo_name = "HugoZeballos/rapa_nui_asr_2" # Ajusta al nombre de tu modelo en Hugging Face
|
| 19 |
processor = Speech2TextProcessor.from_pretrained(repo_name)
|
| 20 |
+
model = Speech2TextForConditionalGeneration.from_pretrained(repo_name).to(device)
|
| 21 |
|
| 22 |
def transcribe(audio_path):
|
| 23 |
audio, sr = librosa.load(audio_path, sr=16000)
|