Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def get_user_question():
|
|
29 |
# Process image
|
30 |
def process_image(uploaded_file):
|
31 |
image = Image.open(uploaded_file)
|
32 |
-
image = image.resize((
|
33 |
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
34 |
return image
|
35 |
|
@@ -117,17 +117,19 @@ def main():
|
|
117 |
st.write(f"Description for file {idx + 1}:")
|
118 |
st.write(description)
|
119 |
all_output_texts.append(description)
|
120 |
-
|
121 |
-
|
122 |
-
st.
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
131 |
|
132 |
if __name__ == "__main__":
|
133 |
main()
|
|
|
29 |
# Process image
|
30 |
def process_image(uploaded_file):
|
31 |
image = Image.open(uploaded_file)
|
32 |
+
image = image.resize((256,256)) # Reduce size to save memory
|
33 |
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
34 |
return image
|
35 |
|
|
|
117 |
st.write(f"Description for file {idx + 1}:")
|
118 |
st.write(description)
|
119 |
all_output_texts.append(description)
|
120 |
+
|
121 |
+
# Store descriptions in session state
|
122 |
+
st.session_state["all_output_texts"] = all_output_texts
|
123 |
+
|
124 |
+
# Check if descriptions are available in session state
|
125 |
+
if "all_output_texts" in st.session_state and st.session_state["all_output_texts"]:
|
126 |
+
st.write("Generate story")
|
127 |
+
generate_story_button = st.button("Generate Story", key="generate_story")
|
128 |
+
|
129 |
+
if generate_story_button:
|
130 |
+
story = generate_story(st.session_state["all_output_texts"])
|
131 |
+
st.write("Generated Story:")
|
132 |
+
st.write(story)
|
133 |
|
134 |
if __name__ == "__main__":
|
135 |
main()
|