Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,7 +81,6 @@ def generate_story(descriptions):
|
|
| 81 |
# Main function to control the flow
|
| 82 |
def main():
|
| 83 |
st.title("Media Story Generator")
|
| 84 |
-
all_output_texts = []
|
| 85 |
|
| 86 |
# Step 1: Load the model
|
| 87 |
processor, model, device = load_model()
|
|
@@ -96,9 +95,10 @@ def main():
|
|
| 96 |
if user_question:
|
| 97 |
# Step 4: Generate description
|
| 98 |
st.write("Step 4: Generate description")
|
| 99 |
-
generate_description_button = st.button("Generate Description")
|
| 100 |
|
| 101 |
if generate_description_button:
|
|
|
|
| 102 |
|
| 103 |
for uploaded_file in uploaded_files:
|
| 104 |
file_type = uploaded_file.type.split('/')[0]
|
|
@@ -122,10 +122,11 @@ def main():
|
|
| 122 |
del image
|
| 123 |
torch.cuda.empty_cache()
|
| 124 |
torch.manual_seed(0)
|
| 125 |
-
|
| 126 |
if all_output_texts:
|
| 127 |
# Step 5: Generate story
|
| 128 |
-
|
|
|
|
| 129 |
|
| 130 |
if generate_story_button:
|
| 131 |
story = generate_story(all_output_texts)
|
|
|
|
| 81 |
# Main function to control the flow
|
| 82 |
def main():
|
| 83 |
st.title("Media Story Generator")
|
|
|
|
| 84 |
|
| 85 |
# Step 1: Load the model
|
| 86 |
processor, model, device = load_model()
|
|
|
|
| 95 |
if user_question:
|
| 96 |
# Step 4: Generate description
|
| 97 |
st.write("Step 4: Generate description")
|
| 98 |
+
generate_description_button = st.button("Generate Description", key="generate_description")
|
| 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]
|
|
|
|
| 122 |
del image
|
| 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)
|