tournas commited on
Commit
bf5369d
·
verified ·
1 Parent(s): 6711ff6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -19
app.py CHANGED
@@ -65,25 +65,15 @@ def text_to_speech(story):
65
  tts.save(audio_file_path)
66
  return audio_file_path
67
 
68
- demo = gr.Interface(
69
- fn=[detect_objects, generate_story, summarize_story, generate_images, text_to_speech],
70
- inputs=[
71
- gr.Image(type="numpy"), # Detect Objects
72
- gr.Textbox(placeholder="Write a story prompt..."), # Generate Story
73
- gr.Textbox(placeholder="Enter the generated story..."), # Summarize Story
74
- gr.Textbox(placeholder="Enter the story for image generation..."), # Generate Images
75
- gr.Textbox(placeholder="Enter text to convert to speech...") # Text to Speech
76
- ],
77
- outputs=[
78
- gr.Textbox(label="Detected Objects"),
79
- gr.Textbox(label="Generated Story"),
80
- gr.Textbox(label="Story Summary"),
81
- gr.Image(label="Generated Images"),
82
- gr.Audio(label="Generated Speech")
83
- ],
84
- title="AI-Powered Storytelling Assistant",
85
- description="An AI assistant combining Object Detection, NLP, Image Generation, and TTS!"
86
- )
87
 
88
  if __name__ == "__main__":
89
  demo.launch()
 
65
  tts.save(audio_file_path)
66
  return audio_file_path
67
 
68
+ detect_interface = gr.Interface(fn=detect_objects, inputs="image", outputs="text", title="Object Detection")
69
+ story_interface = gr.Interface(fn=generate_story, inputs="text", outputs="text", title="Story Generation")
70
+ summary_interface = gr.Interface(fn=summarize_story, inputs="text", outputs="text", title="Story Summarization")
71
+ image_interface = gr.Interface(fn=generate_images, inputs="text", outputs="image", title="Image Generation")
72
+ audio_interface = gr.Interface(fn=text_to_speech, inputs="text", outputs="audio", title="Text to Speech")
73
+
74
+ # Συνδυασμός των interfaces σε ένα Gradio Tabbed Interface
75
+ demo = gr.TabbedInterface([detect_interface, story_interface, summary_interface, image_interface, audio_interface],
76
+ ["Detect Objects", "Generate Story", "Summarize Story", "Generate Images", "Text to Speech"])
 
 
 
 
 
 
 
 
 
 
77
 
78
  if __name__ == "__main__":
79
  demo.launch()