Spaces:
Sleeping
Sleeping
# 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() |