Darknightcoder commited on
Commit
2be961a
1 Parent(s): a1322b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -46,15 +46,23 @@ if generate_prompt_button:
46
  with st.form(key='image_form'):
47
  generate_image_button = st.form_submit_button(label='Generate Image')
48
 
 
 
49
  if generate_image_button and st.session_state['dynamic_prompt']:
50
- # Here, integrate with your custom model to generate the image
51
- # For now, using a placeholder URL
52
- st.session_state['image_url'] = "url_of_your_generated_image"
53
- st.session_state['image_generated'] = True
54
 
55
- # Display the generated image
56
  if st.session_state['image_url']:
57
- st.image(st.session_state['image_url'], caption="Generated Image", use_column_width=True)
 
 
 
 
 
 
58
 
59
  # Download button for the generated image
60
  if st.session_state['image_generated']:
 
46
  with st.form(key='image_form'):
47
  generate_image_button = st.form_submit_button(label='Generate Image')
48
 
49
+
50
+
51
  if generate_image_button and st.session_state['dynamic_prompt']:
52
+ # Integrate with your custom model to generate the image
53
+ # Assuming 'my_custom_model_generate_image' is a function that returns the image URL
54
+ st.session_state['image_url'] = my_custom_model_generate_image(st.session_state['dynamic_prompt'])
55
+ st.session_state['image_generated'] = st.session_state['image_url'] is not None
56
 
57
+ # Display the generated image if the URL is valid
58
  if st.session_state['image_url']:
59
+ try:
60
+ st.image(st.session_state['image_url'], caption="Generated Image", use_column_width=True)
61
+ except Exception as e:
62
+ st.error(f"Failed to load image from URL: {e}")
63
+
64
+
65
+
66
 
67
  # Download button for the generated image
68
  if st.session_state['image_generated']: