navidved commited on
Commit
39a9210
·
verified ·
1 Parent(s): 6e17754

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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(file):
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': (file.name, file, 'audio/mpeg'),
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="file"),
35
  outputs="text",
36
- title="Gooya v1 Persian ASR Transcription",
37
- description="Upload an audio file in Persian, and this Model will transcribe it."
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()