Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -95,12 +95,12 @@ def main():
|
|
95 |
if user_question:
|
96 |
# Step 4: Generate description
|
97 |
st.write("Step 4: Generate description")
|
98 |
-
generate_description_button = st.button("Generate
|
99 |
|
100 |
if generate_description_button:
|
101 |
all_output_texts = []
|
102 |
|
103 |
-
for uploaded_file in uploaded_files:
|
104 |
file_type = uploaded_file.type.split('/')[0]
|
105 |
image = None
|
106 |
|
@@ -114,7 +114,7 @@ def main():
|
|
114 |
|
115 |
if image:
|
116 |
description = generate_description(processor, model, device, image, user_question)
|
117 |
-
st.write("Description:")
|
118 |
st.write(description)
|
119 |
all_output_texts.append(description)
|
120 |
|
@@ -123,15 +123,15 @@ def main():
|
|
123 |
torch.cuda.empty_cache()
|
124 |
torch.manual_seed(0)
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
|
136 |
if __name__ == "__main__":
|
137 |
main()
|
|
|
95 |
if user_question:
|
96 |
# Step 4: Generate description
|
97 |
st.write("Step 4: Generate description")
|
98 |
+
generate_description_button = st.button("Generate Descriptions", key="generate_descriptions")
|
99 |
|
100 |
if generate_description_button:
|
101 |
all_output_texts = []
|
102 |
|
103 |
+
for idx, uploaded_file in enumerate(uploaded_files):
|
104 |
file_type = uploaded_file.type.split('/')[0]
|
105 |
image = None
|
106 |
|
|
|
114 |
|
115 |
if image:
|
116 |
description = generate_description(processor, model, device, image, user_question)
|
117 |
+
st.write(f"Description for file {idx + 1}:")
|
118 |
st.write(description)
|
119 |
all_output_texts.append(description)
|
120 |
|
|
|
123 |
torch.cuda.empty_cache()
|
124 |
torch.manual_seed(0)
|
125 |
|
126 |
+
if all_output_texts:
|
127 |
+
# Step 5: Generate story
|
128 |
+
st.write("Step 5: Generate story")
|
129 |
+
generate_story_button = st.button("Generate Story", key="generate_story")
|
130 |
+
|
131 |
+
if generate_story_button:
|
132 |
+
story = generate_story(all_output_texts)
|
133 |
+
st.write("Generated Story:")
|
134 |
+
st.write(story)
|
135 |
|
136 |
if __name__ == "__main__":
|
137 |
main()
|