Spaces:
Sleeping
Sleeping
Commit
·
d9de62d
1
Parent(s):
dd52fb2
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,28 @@
|
|
1 |
import streamlit as st
|
2 |
from main import generate_image_from_text, upscale_image_esrgan, further_upscale_image
|
3 |
-
import asyncio
|
4 |
-
|
5 |
-
# Here we use asyncio to allow tasks to run concurrently
|
6 |
-
async def run_process():
|
7 |
|
|
|
8 |
st.title("Image Generation and Upscaling")
|
9 |
st.write("Enter a text prompt and an image will be generated and upscaled.")
|
10 |
|
11 |
prompt = st.text_input("Enter a textual prompt to generate an image...")
|
12 |
-
|
13 |
if prompt:
|
14 |
-
|
|
|
15 |
st.write("Generating image from text prompt...")
|
16 |
image_bytes = generate_image_from_text(prompt)
|
17 |
-
|
|
|
18 |
st.write("Upscaling image with ESRGAN...")
|
19 |
upscaled_image_bytes = upscale_image_esrgan(image_bytes)
|
20 |
-
|
|
|
21 |
st.write("Further upscaling image with GFPGAN...")
|
22 |
-
download_link =
|
23 |
-
|
|
|
24 |
st.markdown(download_link, unsafe_allow_html=True)
|
25 |
|
26 |
-
def main():
|
27 |
-
loop = asyncio.get_event_loop()
|
28 |
-
loop.run_until_complete(run_process())
|
29 |
-
|
30 |
if __name__ == "__main__":
|
31 |
main()
|
|
|
1 |
import streamlit as st
|
2 |
from main import generate_image_from_text, upscale_image_esrgan, further_upscale_image
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
def main():
|
5 |
st.title("Image Generation and Upscaling")
|
6 |
st.write("Enter a text prompt and an image will be generated and upscaled.")
|
7 |
|
8 |
prompt = st.text_input("Enter a textual prompt to generate an image...")
|
9 |
+
|
10 |
if prompt:
|
11 |
+
progress_bar = st.progress(0)
|
12 |
+
|
13 |
st.write("Generating image from text prompt...")
|
14 |
image_bytes = generate_image_from_text(prompt)
|
15 |
+
progress_bar.progress(33)
|
16 |
+
|
17 |
st.write("Upscaling image with ESRGAN...")
|
18 |
upscaled_image_bytes = upscale_image_esrgan(image_bytes)
|
19 |
+
progress_bar.progress(66)
|
20 |
+
|
21 |
st.write("Further upscaling image with GFPGAN...")
|
22 |
+
download_link = further_upscale_image(upscaled_image_bytes)
|
23 |
+
progress_bar.progress(100)
|
24 |
+
|
25 |
st.markdown(download_link, unsafe_allow_html=True)
|
26 |
|
|
|
|
|
|
|
|
|
27 |
if __name__ == "__main__":
|
28 |
main()
|