Singularity666/VisionGPT-Automation
0
1# app.py2 3import streamlit as st4import base645from main import generate_and_upscale_image6 7def get_image_download_link(img_bytes, filename):8 b64 = base64.b64encode(img_bytes).decode()9 href = f'<a href="data:image/png;base64,{b64}" download="{filename}">Click to download</a>'10 return href11 12st.title("Generate and Upscale Image")13 14text_prompt = st.text_input("Enter a text prompt")15clipdrop_api_key = st.text_input("Enter your Clipdrop API key")16stability_api_key = st.text_input("Enter your Stability API key")17replicate_api_token = st.text_input("Enter your Replicate API token")18 19if st.button("Generate and Upscale Image"):20 final_image_bytes, error = generate_and_upscale_image(text_prompt, clipdrop_api_key, stability_api_key, replicate_api_token)21 if error:22 st.error(error)23 else:24 st.markdown(get_image_download_link(final_image_bytes, "gfpgan_upscaled_image.png"), unsafe_allow_html=True)25 