Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
import os
|
|
|
4 |
|
5 |
# Retrieve ASR API URL and Authorization Token from environment variables
|
6 |
ASR_API_URL = os.getenv('ASR_API_URL')
|
@@ -18,9 +19,10 @@ def transcribe_audio(file_path):
|
|
18 |
files = {
|
19 |
'file': (file_path, open(file_path, 'rb'), 'audio/mpeg'),
|
20 |
}
|
21 |
-
|
22 |
# Send POST request
|
23 |
response = requests.post(ASR_API_URL, headers=headers, files=files)
|
|
|
24 |
|
25 |
# Check if response is successful
|
26 |
if response.status_code == 200:
|
@@ -41,6 +43,6 @@ gr.Interface(
|
|
41 |
fn=transcribe_audio,
|
42 |
inputs=gr.Audio(type="filepath"), # Updated here
|
43 |
outputs="text",
|
44 |
-
title="Gooya v1.
|
45 |
description="The Gooya model is one of the most powerful and fastest Persian ASR models. Upload an audio file in Persian, and this Model will transcribe it."
|
46 |
).launch()
|
|
|
1 |
import gradio as gr
|
2 |
import requests
|
3 |
import os
|
4 |
+
import time
|
5 |
|
6 |
# Retrieve ASR API URL and Authorization Token from environment variables
|
7 |
ASR_API_URL = os.getenv('ASR_API_URL')
|
|
|
19 |
files = {
|
20 |
'file': (file_path, open(file_path, 'rb'), 'audio/mpeg'),
|
21 |
}
|
22 |
+
start_time = time.time()
|
23 |
# Send POST request
|
24 |
response = requests.post(ASR_API_URL, headers=headers, files=files)
|
25 |
+
inference_time = time.time() - start_time # in seconds
|
26 |
|
27 |
# Check if response is successful
|
28 |
if response.status_code == 200:
|
|
|
43 |
fn=transcribe_audio,
|
44 |
inputs=gr.Audio(type="filepath"), # Updated here
|
45 |
outputs="text",
|
46 |
+
title="Gooya v1.4 Persian ASR",
|
47 |
description="The Gooya model is one of the most powerful and fastest Persian ASR models. Upload an audio file in Persian, and this Model will transcribe it."
|
48 |
).launch()
|