muhtasham commited on
Commit
6c39a0a
1 Parent(s): 98f30e7

speech to text fix

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -7,6 +7,7 @@ from transformers import pipeline
7
 
8
  asr = pipeline("automatic-speech-recognition")
9
  latent = gr.Interface.load("spaces/multimodalart/latentdiffusion")
 
10
  #zero = pipeline("zero-shot-image-classification")
11
  #zero = gr.Interface.load("spaces/Datatrooper/zero-shot-image-classification")
12
  #tts = gr.Interface.load("spaces/osanseviero/tortoisse-tts")
@@ -30,7 +31,7 @@ def text2image_latent(text, steps, width, height, images, diversity):
30
  return(image_paths)
31
 
32
 
33
- def speech_to_text(mic=None, file=None, state=""):
34
  if mic is not None:
35
  audio = mic
36
  elif file is not None:
@@ -38,7 +39,7 @@ def speech_to_text(mic=None, file=None, state=""):
38
  else:
39
  return "You must either provide a mic recording or a file"
40
  transcription = asr(audio)["text"]
41
- return state
42
 
43
 
44
  with gr.Blocks() as demo:
 
7
 
8
  asr = pipeline("automatic-speech-recognition")
9
  latent = gr.Interface.load("spaces/multimodalart/latentdiffusion")
10
+
11
  #zero = pipeline("zero-shot-image-classification")
12
  #zero = gr.Interface.load("spaces/Datatrooper/zero-shot-image-classification")
13
  #tts = gr.Interface.load("spaces/osanseviero/tortoisse-tts")
 
31
  return(image_paths)
32
 
33
 
34
+ def speech_to_text(mic=None, file=None):
35
  if mic is not None:
36
  audio = mic
37
  elif file is not None:
 
39
  else:
40
  return "You must either provide a mic recording or a file"
41
  transcription = asr(audio)["text"]
42
+ return transcription
43
 
44
 
45
  with gr.Blocks() as demo: