Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import os
|
|
6 |
ASR_API_URL = os.getenv('ASR_API_URL')
|
7 |
AUTH_TOKEN = os.getenv('AUTH_TOKEN')
|
8 |
|
9 |
-
def transcribe_audio(
|
10 |
if not ASR_API_URL or not AUTH_TOKEN:
|
11 |
return "Error: Missing ASR_API_URL or AUTH_TOKEN."
|
12 |
|
@@ -16,7 +16,7 @@ def transcribe_audio(file):
|
|
16 |
'Authorization': f'Bearer {AUTH_TOKEN}',
|
17 |
}
|
18 |
files = {
|
19 |
-
'file': (
|
20 |
}
|
21 |
|
22 |
# Send POST request
|
@@ -31,8 +31,8 @@ def transcribe_audio(file):
|
|
31 |
# Set up the Gradio interface
|
32 |
gr.Interface(
|
33 |
fn=transcribe_audio,
|
34 |
-
inputs=gr.Audio(type="
|
35 |
outputs="text",
|
36 |
-
title="
|
37 |
-
description="Upload an audio file in Persian, and this
|
38 |
).launch()
|
|
|
6 |
ASR_API_URL = os.getenv('ASR_API_URL')
|
7 |
AUTH_TOKEN = os.getenv('AUTH_TOKEN')
|
8 |
|
9 |
+
def transcribe_audio(file_path):
|
10 |
if not ASR_API_URL or not AUTH_TOKEN:
|
11 |
return "Error: Missing ASR_API_URL or AUTH_TOKEN."
|
12 |
|
|
|
16 |
'Authorization': f'Bearer {AUTH_TOKEN}',
|
17 |
}
|
18 |
files = {
|
19 |
+
'file': (file_path, open(file_path, 'rb'), 'audio/mpeg'),
|
20 |
}
|
21 |
|
22 |
# Send POST request
|
|
|
31 |
# Set up the Gradio interface
|
32 |
gr.Interface(
|
33 |
fn=transcribe_audio,
|
34 |
+
inputs=gr.Audio(type="filepath"), # Updated here
|
35 |
outputs="text",
|
36 |
+
title="Persian ASR Transcription",
|
37 |
+
description="Upload an audio file in Persian, and this app will transcribe it."
|
38 |
).launch()
|