gaspar-avit commited on
Commit
865c275
1 Parent(s): 65cf2b0

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -190,7 +190,7 @@ def query_generate(text):
190
  response = requests.post(API_URL, headers=headers, json=payload)
191
  return response.content
192
 
193
-
194
  def generate_poster(movie_data):
195
  """
196
  Function for recommending movies
@@ -221,17 +221,17 @@ def generate_poster(movie_data):
221
  st.text("")
222
  st.text("")
223
  st.subheader("Resulting poster:")
224
- col1, col2, col3 = st.columns(3)
225
 
226
  with col1:
227
- st.write(' ')
228
 
229
  with col2:
230
  st.text("")
231
  st.image(image, caption="Movie: \"" + movie_data.title.values[0] + "\"")
232
 
233
  with col3:
234
- st.write(' ')
235
 
236
  except:
237
  st.text(poster_image)
@@ -282,11 +282,13 @@ if __name__ == "__main__":
282
 
283
  buffer1, col1, buffer2 = st.columns([1.3, 1, 1])
284
 
285
- is_clicked = col1.button(label="Generate poster!")
286
- is_clicked_rerun = None
 
287
 
288
- if is_clicked:
289
- poster = generate_poster(data[data.title_year==selected_movie])
 
290
 
291
  _= """
292
  if poster is not None:
 
190
  response = requests.post(API_URL, headers=headers, json=payload)
191
  return response.content
192
 
193
+ @st.experimental_singleton()
194
  def generate_poster(movie_data):
195
  """
196
  Function for recommending movies
 
221
  st.text("")
222
  st.text("")
223
  st.subheader("Resulting poster:")
224
+ col1, col2, col3 = st.columns([1, 10, 1])
225
 
226
  with col1:
227
+ st.write("")
228
 
229
  with col2:
230
  st.text("")
231
  st.image(image, caption="Movie: \"" + movie_data.title.values[0] + "\"")
232
 
233
  with col3:
234
+ st.write("")
235
 
236
  except:
237
  st.text(poster_image)
 
282
 
283
  buffer1, col1, buffer2 = st.columns([1.3, 1, 1])
284
 
285
+ while 1:
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
  if poster is not None: