jbilcke-hf HF staff commited on
Commit
8bdb39b
1 Parent(s): 38d7590

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -605,13 +605,12 @@ def generate_story_and_speech(input_text, chatbot_role):
605
  # Return JSON object with text and base64 audio
606
  return {"text": story_text, "audio": speech_audio_base64}
607
 
608
- # Define your Gradio app API
609
- iface = gr.Interface(
610
  fn=generate_story_and_speech,
611
- inputs=[gr.Textbox(label="Enter your text"), gr.Dropdown(choices=ROLES, label="Chatbot Role")],
612
  outputs="json"
613
  )
614
 
615
- # Launch the app
616
- if __name__ == "__main__":
617
- iface.launch(debug=True, enable_queue=True, api_mode=True)
 
605
  # Return JSON object with text and base64 audio
606
  return {"text": story_text, "audio": speech_audio_base64}
607
 
608
+ # Create a Gradio Interface using only the `generate_story_and_speech()` function and the 'json' output type
609
+ demo = gr.Interface(
610
  fn=generate_story_and_speech,
611
+ inputs=[gr.Textbox(placeholder="Enter your text here"), gr.Dropdown(choices=ROLES, label="Select Chatbot Role")],
612
  outputs="json"
613
  )
614
 
615
+ demo.queue()
616
+ demo.launch(debug=True)