Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,7 +72,7 @@ def main():
|
|
| 72 |
|
| 73 |
if st.button(':blue[Generate Image]', use_container_width=True):
|
| 74 |
with st.spinner('Generating Image...'):
|
| 75 |
-
result = generate_image(api_key, prompt, aspect_ratios, mode, models, seed, output_formats, strength, negative_prompt, uploaded_file
|
| 76 |
if result.status_code == 200:
|
| 77 |
image = Image.open(io.BytesIO(result.content))
|
| 78 |
st.image(image, use_column_width=True)
|
|
@@ -82,7 +82,7 @@ def main():
|
|
| 82 |
st.success(f'Image saved to {file_path}')
|
| 83 |
# Download generated image for Huggingface Spaces add-on
|
| 84 |
with open(file_path, "rb") as file:
|
| 85 |
-
|
| 86 |
else:
|
| 87 |
st.error('Failed to generate image: ' + str(result.json()))
|
| 88 |
|
|
|
|
| 72 |
|
| 73 |
if st.button(':blue[Generate Image]', use_container_width=True):
|
| 74 |
with st.spinner('Generating Image...'):
|
| 75 |
+
result = generate_image(api_key, prompt, aspect_ratios, mode, models, seed, output_formats, strength, negative_prompt, uploaded_file)
|
| 76 |
if result.status_code == 200:
|
| 77 |
image = Image.open(io.BytesIO(result.content))
|
| 78 |
st.image(image, use_column_width=True)
|
|
|
|
| 82 |
st.success(f'Image saved to {file_path}')
|
| 83 |
# Download generated image for Huggingface Spaces add-on
|
| 84 |
with open(file_path, "rb") as file:
|
| 85 |
+
st.download_button(label=":green[Download Image]", data=file, file_name=file_path, mime=f"image/{output_formats}", use_container_width=True)
|
| 86 |
else:
|
| 87 |
st.error('Failed to generate image: ' + str(result.json()))
|
| 88 |
|