gaspar-avit commited on
Commit
073cf07
1 Parent(s): 233b641

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -215,6 +215,7 @@ def generate_poster(movie_data):
215
  with st.spinner("Generating poster image..."):
216
  poster_image = query_generate(synopsis_sum)
217
 
 
218
  # Show image
219
  try:
220
  image = Image.open(io.BytesIO(poster_image))
@@ -276,22 +277,28 @@ if __name__ == "__main__":
276
  st.text("")
277
  st.text("")
278
 
 
279
  selected_movie = st.selectbox(label="Select a movie to generate alternative poster", options=data.title_year)
280
 
281
  st.text("")
282
  st.text("")
283
 
 
284
  buffer1, col1, buffer2 = st.columns([1.3, 1, 1])
285
-
286
  is_clicked = col1.button(label="Generate poster!")
287
- is_clicked_rerun = None
288
 
 
289
  if is_clicked:
290
  poster = generate_poster(data[data.title_year==selected_movie])
291
  generate_poster.clear()
292
 
 
 
 
 
293
 
294
  _= """
 
295
  if poster is not None:
296
  buffer1, col1, buffer2 = st.columns([1.3, 1, 1])
297
  is_clicked_rerun = col1.button(label="Rerun with same movie!")
 
215
  with st.spinner("Generating poster image..."):
216
  poster_image = query_generate(synopsis_sum)
217
 
218
+
219
  # Show image
220
  try:
221
  image = Image.open(io.BytesIO(poster_image))
 
277
  st.text("")
278
  st.text("")
279
 
280
+ ## Select box with all the movies as choices
281
  selected_movie = st.selectbox(label="Select a movie to generate alternative poster", options=data.title_year)
282
 
283
  st.text("")
284
  st.text("")
285
 
286
+ ## Create button to trigger poster generation
287
  buffer1, col1, buffer2 = st.columns([1.3, 1, 1])
 
288
  is_clicked = col1.button(label="Generate poster!")
 
289
 
290
+ ## Generate poster
291
  if is_clicked:
292
  poster = generate_poster(data[data.title_year==selected_movie])
293
  generate_poster.clear()
294
 
295
+ ## Clear cache between runs
296
+ st.runtime.legacy_caching.clear_cache()
297
+ generate_poster.clear()
298
+
299
 
300
  _= """
301
+ is_clicked_rerun = None
302
  if poster is not None:
303
  buffer1, col1, buffer2 = st.columns([1.3, 1, 1])
304
  is_clicked_rerun = col1.button(label="Rerun with same movie!")