File size: 1,111 Bytes
8bb6a15
 
656d47c
c17fbdc
d594335
8bb6a15
d594335
8bb6a15
d594335
8bb6a15
d594335
8bb6a15
d594335
 
 
8bb6a15
d594335
 
 
 
 
 
c17fbdc
d594335
 
c17fbdc
 
d594335
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# app.py

import streamlit as st
from main import generate_and_upscale_image
import os

def main():

    st.title("Image Generator and Upscaler")

    text_prompt = st.text_input("Enter your text prompt")

    clipdrop_api_key = st.text_input("Enter your ClipDrop API Key", type="password")
    stability_api_key = st.text_input("Enter your Stability API Key", type="password")
    replicate_api_token = st.text_input("Enter your Replicate API Token", type="password")

    download_path = st.text_input("Enter the path where the image will be saved")
    if not os.path.exists(download_path):
        st.error("The provided download path does not exist. Please provide a valid path.")
        return

    if st.button("Generate and Upscale"):
        try:
            generate_and_upscale_image(text_prompt, clipdrop_api_key, stability_api_key, replicate_api_token, download_path)
            st.success("The image has been successfully generated, upscaled, and saved to the specified path.")
        except Exception as e:
            st.error(f"An error occurred: {e}")

if __name__ == "__main__":
    main()