Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
import os
|
2 |
-
import io
|
3 |
import gradio as gr
|
4 |
import requests
|
5 |
import subprocess
|
6 |
-
import huggingface_hub
|
7 |
|
8 |
-
# Obtener la API Key desde Hugging Face
|
9 |
-
API_KEY =
|
10 |
|
11 |
# Verificar si la API Key está configurada
|
12 |
if not API_KEY:
|
13 |
raise ValueError("La API Key de Hugging Face no está disponible. Configúrala en los Secrets de Hugging Face Spaces.")
|
14 |
|
15 |
# URL del modelo de transcripción en Hugging Face
|
16 |
-
HF_MODEL = "facebook/wav2vec2-large-xlsr-53-spanish"
|
17 |
API_URL = f"https://api-inference.huggingface.co/models/{HF_MODEL}"
|
18 |
|
19 |
-
# Headers para la solicitud
|
20 |
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
|
21 |
|
22 |
def convert_to_wav(input_file):
|
|
|
1 |
import os
|
|
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
import subprocess
|
|
|
5 |
|
6 |
+
# Obtener la API Key desde los Secrets de Hugging Face
|
7 |
+
API_KEY = os.environ.get("HUGGINGFACEHUB_API_TOKEN") or os.environ.get("HUGGINGFACE_API_KEY")
|
8 |
|
9 |
# Verificar si la API Key está configurada
|
10 |
if not API_KEY:
|
11 |
raise ValueError("La API Key de Hugging Face no está disponible. Configúrala en los Secrets de Hugging Face Spaces.")
|
12 |
|
13 |
# URL del modelo de transcripción en Hugging Face
|
14 |
+
HF_MODEL = "facebook/wav2vec2-large-xlsr-53-spanish"
|
15 |
API_URL = f"https://api-inference.huggingface.co/models/{HF_MODEL}"
|
16 |
|
|
|
17 |
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
|
18 |
|
19 |
def convert_to_wav(input_file):
|