Geek7 commited on
Commit
cdc56f1
·
verified ·
1 Parent(s): aed7dad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -4
app.py CHANGED
@@ -1,9 +1,24 @@
1
  import gradio as gr
 
2
 
3
- # Load the model from Hugging Face and hide the tagline using CSS
4
- demo = gr.Interface.load(
5
- "models/speechbrain/mtl-mimic-voicebank",
6
- css=".footer {display: none !important;}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  )
8
 
9
  # Launch the interface
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load the model separately
5
+ model = pipeline("automatic-speech-recognition", model="speechbrain/mtl-mimic-voicebank")
6
+
7
+ # Define a function to make predictions using the loaded model
8
+ def transcribe(audio):
9
+ return model(audio)["text"]
10
+
11
+ # Define a CSS string to hide the footer
12
+ custom_css = """
13
+ footer {visibility: hidden;}
14
+ """
15
+
16
+ # Create the Gradio interface
17
+ demo = gr.Interface(
18
+ fn=transcribe, # Function to process input
19
+ inputs=gr.Audio(source="microphone", type="filepath"), # Take audio input
20
+ outputs="text", # Display output as text
21
+ css=custom_css # Hide the Gradio footer
22
  )
23
 
24
  # Launch the interface