mrbeliever commited on
Commit
45f5c71
·
verified ·
1 Parent(s): b879fdc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -30,7 +30,7 @@ def generate_caption(image_base64, api_key):
30
  "messages": [
31
  {"role": "system", "content": "You are an image-to-text prompt converter for AI image generation."},
32
  {"role": "user", "content": [
33
- {"type": "text", "text": "Describe This Image In Detail under 100 words."},
34
  {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"}},
35
  ]},
36
  ],
@@ -62,7 +62,7 @@ if uploaded_image and API_KEY:
62
  st.image(image, caption="Uploaded Image", use_container_width=True)
63
 
64
  if st.button("Generate Image", use_container_width=True):
65
- st.write("Generating Prompt...")
66
  result = generate_caption(image_base64, API_KEY)
67
 
68
  if "error" in result:
@@ -74,7 +74,7 @@ if uploaded_image and API_KEY:
74
  # Construct the image generation URL
75
  image_url = f"https://image.pollinations.ai/prompt/{requests.utils.quote(caption)}?width={width}&height={height}&nologo=true&model=flux&enhance=true&seed=119"
76
 
77
- st.image(image_url, caption="Generated Image", use_column_width=True)
78
 
79
  # Download button for the generated image
80
  st.markdown(f"[Download Image]({image_url})", unsafe_allow_html=True)
 
30
  "messages": [
31
  {"role": "system", "content": "You are an image-to-text prompt converter for AI image generation."},
32
  {"role": "user", "content": [
33
+ {"type": "text", "text": "Describe This Image In Detail under 100 words in this format: [image content/subject, description of action, state, and mood], [art form, style], [artist/photographer reference if needed], [additional settings such as camera and lens settings, lighting, colors, effects, texture, background, rendering]."},
34
  {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_base64}"}},
35
  ]},
36
  ],
 
62
  st.image(image, caption="Uploaded Image", use_container_width=True)
63
 
64
  if st.button("Generate Image", use_container_width=True):
65
+ st.write("Generating...")
66
  result = generate_caption(image_base64, API_KEY)
67
 
68
  if "error" in result:
 
74
  # Construct the image generation URL
75
  image_url = f"https://image.pollinations.ai/prompt/{requests.utils.quote(caption)}?width={width}&height={height}&nologo=true&model=flux&enhance=true&seed=119"
76
 
77
+ st.image(image_url, caption="Generated Image", use_container_width=True)
78
 
79
  # Download button for the generated image
80
  st.markdown(f"[Download Image]({image_url})", unsafe_allow_html=True)