AlexWortega commited on
Commit
8b78c8f
1 Parent(s): 8d15bff

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +27 -4
main.py CHANGED
@@ -166,7 +166,7 @@ audio_to_text_interface = gr.Interface(
166
  )
167
 
168
  # Gradio Demo
169
- demo = gr.TabbedInterface([text_to_audio_interface, audio_to_text_interface], ["Text - Audio", "Audio - Text"])
170
 
171
  # Custom CSS for centered links
172
  custom_css = """
@@ -201,6 +201,29 @@ Explore the tabs to try the **Text - Audio** and **Audio - Text** modes!
201
  </div>
202
 
203
  """
204
-
205
- # Launch Gradio App
206
- demo.launch(share=True, description=description)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  )
167
 
168
  # Gradio Demo
169
+ #demo = gr.TabbedInterface([text_to_audio_interface, audio_to_text_interface], ["Text - Audio", "Audio - Text"])
170
 
171
  # Custom CSS for centered links
172
  custom_css = """
 
201
  </div>
202
 
203
  """
204
+ with gr.Blocks() as demo:
205
+ gr.Markdown(description)
206
+ with gr.Tabs():
207
+ with gr.TabItem("Text - Audio"):
208
+ text_to_audio_interface = gr.Interface(
209
+ fn=infer_text_to_audio_gr,
210
+ inputs=gr.Textbox(label="Input Text"),
211
+ outputs=gr.Audio(label="Audio Answer"),
212
+ title="T2S",
213
+ description="Model in text to audio mode",
214
+ allow_flagging='never',
215
+ )
216
+ text_to_audio_interface.render()
217
+ with gr.TabItem("Audio - Text"):
218
+ audio_to_text_interface = gr.Interface(
219
+ fn=infer_audio_to_text_gr,
220
+ inputs=gr.Audio(type="filepath", label="Input Audio"),
221
+ outputs=gr.Textbox(label="Text Answer"),
222
+ title="S2T",
223
+ description="Model in audio to text mode",
224
+ allow_flagging='never'
225
+ )
226
+ audio_to_text_interface.render()
227
+
228
+ # Launch the demo
229
+ demo.launch(share=True)