Spaces:
Sleeping
Sleeping
Commit
·
d594335
1
Parent(s):
65741b8
Update app.py
Browse files
app.py
CHANGED
@@ -2,29 +2,29 @@
|
|
2 |
|
3 |
import streamlit as st
|
4 |
from main import generate_and_upscale_image
|
|
|
5 |
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
stability_api_key = st.secrets['STABILITY_API_KEY']
|
10 |
-
replicate_api_token = st.secrets['REPLICATE_API_TOKEN']
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
if
|
|
|
|
|
|
|
|
|
18 |
try:
|
19 |
-
generate_and_upscale_image(
|
20 |
-
|
21 |
-
clipdrop_api_key,
|
22 |
-
stability_api_key,
|
23 |
-
replicate_api_token,
|
24 |
-
download_path
|
25 |
-
)
|
26 |
-
st.success('Image saved successfully at the specified download path.')
|
27 |
except Exception as e:
|
28 |
st.error(f"An error occurred: {e}")
|
29 |
-
|
30 |
-
|
|
|
|
2 |
|
3 |
import streamlit as st
|
4 |
from main import generate_and_upscale_image
|
5 |
+
import os
|
6 |
|
7 |
+
def main():
|
8 |
|
9 |
+
st.title("Image Generator and Upscaler")
|
|
|
|
|
10 |
|
11 |
+
text_prompt = st.text_input("Enter your text prompt")
|
12 |
|
13 |
+
clipdrop_api_key = st.text_input("Enter your ClipDrop API Key", type="password")
|
14 |
+
stability_api_key = st.text_input("Enter your Stability API Key", type="password")
|
15 |
+
replicate_api_token = st.text_input("Enter your Replicate API Token", type="password")
|
16 |
|
17 |
+
download_path = st.text_input("Enter the path where the image will be saved")
|
18 |
+
if not os.path.exists(download_path):
|
19 |
+
st.error("The provided download path does not exist. Please provide a valid path.")
|
20 |
+
return
|
21 |
+
|
22 |
+
if st.button("Generate and Upscale"):
|
23 |
try:
|
24 |
+
generate_and_upscale_image(text_prompt, clipdrop_api_key, stability_api_key, replicate_api_token, download_path)
|
25 |
+
st.success("The image has been successfully generated, upscaled, and saved to the specified path.")
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
except Exception as e:
|
27 |
st.error(f"An error occurred: {e}")
|
28 |
+
|
29 |
+
if __name__ == "__main__":
|
30 |
+
main()
|