Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,10 @@ model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
|
13 |
)
|
14 |
processor = AutoProcessor.from_pretrained("daniel3303/QwenStoryteller")
|
15 |
|
|
|
|
|
|
|
|
|
16 |
@spaces.GPU()
|
17 |
def generate_story(images):
|
18 |
image_content = []
|
@@ -68,12 +72,20 @@ def generate_story(images):
|
|
68 |
|
69 |
return story
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
)
|
78 |
|
79 |
if __name__ == "__main__":
|
|
|
13 |
)
|
14 |
processor = AutoProcessor.from_pretrained("daniel3303/QwenStoryteller")
|
15 |
|
16 |
+
def upload_file(files):
|
17 |
+
file_paths = [file.name for file in files]
|
18 |
+
return file_paths
|
19 |
+
|
20 |
@spaces.GPU()
|
21 |
def generate_story(images):
|
22 |
image_content = []
|
|
|
72 |
|
73 |
return story
|
74 |
|
75 |
+
with gr.Blocks() as demo:
|
76 |
+
gr.Markdown("# Qwen Storyteller \n## Upload up to 6 images to generate a creative story.")
|
77 |
+
with gr.Row():
|
78 |
+
with gr.Column():
|
79 |
+
file_output = gr.File()
|
80 |
+
upload_button = gr.UploadButton("Upload up to 6 images", file_types=["image", "video"], file_count="multiple")
|
81 |
+
gen_button = gr.Button("Generate", variant="secondary")
|
82 |
+
|
83 |
+
with gr.Column():
|
84 |
+
outputs=gr.Textbox(label="Generated Story", lines=10)
|
85 |
+
|
86 |
+
upload_button.upload(upload_file, upload_button, file_output)
|
87 |
+
gen_button.click(fn=generate_story, file_output, outputs)
|
88 |
+
|
89 |
)
|
90 |
|
91 |
if __name__ == "__main__":
|