Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -65,15 +65,29 @@ def text_to_speech(story):
|
|
65 |
tts.save(audio_file_path)
|
66 |
return audio_file_path
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
65 |
tts.save(audio_file_path)
|
66 |
return audio_file_path
|
67 |
|
68 |
+
def full_pipeline(image):
|
69 |
+
detected_objects = detect_objects(image)
|
70 |
+
story = generate_story(detected_objects)
|
71 |
+
scenes = summarize_story(story)
|
72 |
+
images = generate_images(scenes)
|
73 |
+
audio = text_to_speech(story)
|
74 |
+
|
75 |
+
return story, scenes, images, audio
|
76 |
+
|
77 |
+
# **Gradio UI**
|
78 |
+
demo = gr.Interface(
|
79 |
+
fn=full_pipeline,
|
80 |
+
inputs=gr.Image(type="pil"),
|
81 |
+
outputs=[
|
82 |
+
gr.Textbox(label="Generated Story"),
|
83 |
+
gr.Textbox(label="Story Scenes"),
|
84 |
+
gr.Gallery(label="Generated Images"),
|
85 |
+
gr.Audio(label="Story Audio"),
|
86 |
+
],
|
87 |
+
title="AI-Powered Storytelling Assistant",
|
88 |
+
description="Upload an image, and the AI will detect objects, generate a story, create images, and narrate the story."
|
89 |
+
)
|
90 |
|
|
|
|
|
|
|
91 |
|
92 |
if __name__ == "__main__":
|
93 |
demo.launch()
|