futranbg commited on
Commit
add7e1d
1 Parent(s): 4f1831f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -8,7 +8,6 @@ HF_TOKEN = os.environ.get("HF_TOKEN", None)
8
  API_URL = "https://api-inference.huggingface.co/models/"
9
 
10
  def s2t(audio, model_name):
11
- print(f"Filepath: {audio}")
12
  with open(audio, "rb") as f:
13
  data = f.read()
14
  try:
@@ -25,8 +24,9 @@ def s2t(audio, model_name):
25
  with gr.Blocks() as demo:
26
  with gr.Row():
27
  with gr.Column():
28
- voice = gr.Microphone(type="filepath")
29
- audio = gr.Audio(sources=["upload"], type="filepath")
 
30
  model_name = gr.Dropdown(
31
  label="Models:",
32
  choices=[
@@ -43,7 +43,7 @@ with gr.Blocks() as demo:
43
  with gr.Column():
44
  output = gr.Textbox(label="Transcription results")
45
 
46
- voice.change(s2t, inputs=[voice, model_name], outputs=output, concurrency_limit=4)
47
- audio.upload(s2t, inputs=[audio, model_name], outputs=output, concurrency_limit=4)
48
-
49
- demo.queue().launch()
 
8
  API_URL = "https://api-inference.huggingface.co/models/"
9
 
10
  def s2t(audio, model_name):
 
11
  with open(audio, "rb") as f:
12
  data = f.read()
13
  try:
 
24
  with gr.Blocks() as demo:
25
  with gr.Row():
26
  with gr.Column():
27
+ voice = gr.Microphone(source="microphone", type="filepath", label="Voice",
28
+ interactive=True, streaming=False)
29
+ audio = gr.Audio(source="upload", type="filepath", label="Audio file")
30
  model_name = gr.Dropdown(
31
  label="Models:",
32
  choices=[
 
43
  with gr.Column():
44
  output = gr.Textbox(label="Transcription results")
45
 
46
+ voice.change(s2t, inputs=[voice, model_name], outputs=output)
47
+ audio.upload(s2t, inputs=[audio, model_name], outputs=output)
48
+
49
+ demo.queue(concurrency_count=8).launch()