eaglelandsonce commited on
Commit
aeee856
1 Parent(s): 448077f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -7
app.py CHANGED
@@ -282,6 +282,9 @@ if 'text_block' not in st.session_state:
282
  if 'on_topic' not in st.session_state:
283
  st.session_state['on_topic'] = ''
284
 
 
 
 
285
  st.set_page_config(page_title='Clarifai Story Teller', layout='wide')
286
 
287
 
@@ -319,14 +322,15 @@ with tab2:
319
  cols = st.columns(4)
320
  with st.spinner('Generating Content...'):
321
  for i, prompt in enumerate(prompts):
322
- image, img_error = generate_image(prompt+st.session_state.on_topic )
323
  audio, audio_error = generate_audio(prompt)
324
 
325
  with cols[i % 4]:
326
  if img_error:
327
  st.error(img_error)
328
  else:
329
- st.image(image, prompt, use_column_width=True)
 
330
 
331
  if audio_error:
332
  st.error(audio_error)
@@ -335,8 +339,14 @@ with tab2:
335
 
336
  # Tab 3: User Input and Results
337
  with tab3:
338
- st.header("Interactive User Input")
339
- user_input = st.text_input("Enter some information")
340
- st.write(f"You entered: {user_input}")
341
-
342
-
 
 
 
 
 
 
 
282
  if 'on_topic' not in st.session_state:
283
  st.session_state['on_topic'] = ''
284
 
285
+ if 'image_paths' not in st.session_state:
286
+ st.session_state['image_paths'] = []
287
+
288
  st.set_page_config(page_title='Clarifai Story Teller', layout='wide')
289
 
290
 
 
322
  cols = st.columns(4)
323
  with st.spinner('Generating Content...'):
324
  for i, prompt in enumerate(prompts):
325
+ image_path, img_error = generate_image(prompt+st.session_state.on_topic )
326
  audio, audio_error = generate_audio(prompt)
327
 
328
  with cols[i % 4]:
329
  if img_error:
330
  st.error(img_error)
331
  else:
332
+ st.session_state['image_paths'].append(image_path)
333
+ st.image(image_path, prompt, use_column_width=True)
334
 
335
  if audio_error:
336
  st.error(audio_error)
 
339
 
340
  # Tab 3: User Input and Results
341
  with tab3:
342
+ if 'image_paths' in st.session_state:
343
+ for i in range(0, len(st.session_state['image_paths']), 4):
344
+ cols = st.columns(4)
345
+ for j in range(4):
346
+ idx = i + j
347
+ if idx < len(st.session_state['image_paths']):
348
+ with cols[j]:
349
+ st.image(st.session_state['image_paths'][idx], use_column_width=True)
350
+ if st.button(f"Details {idx}", key=f"button_{idx}"):
351
+ st.write(f"You clicked on image {idx}")
352
+ # Add more actions for the click event here