Spaces:
Running
Running
Mr-Vicky-01
commited on
Commit
•
4e4e6a3
1
Parent(s):
80f487d
Update app.py
Browse filescorrect the "arist" to "artist" spelling mistake.
app.py
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from llm import Model
|
3 |
-
from image_engine import ImageGenerator
|
4 |
-
import io
|
5 |
-
|
6 |
-
# Instantiate the models
|
7 |
-
gemini_model = Model()
|
8 |
-
image_generator = ImageGenerator()
|
9 |
-
|
10 |
-
# Streamlit interface
|
11 |
-
st.title("AI
|
12 |
-
art_idea = st.text_input("Enter your drawing idea:")
|
13 |
-
|
14 |
-
if st.button("Generate Art"):
|
15 |
-
if art_idea:
|
16 |
-
with st.spinner("Enhancing your idea..."):
|
17 |
-
enhanced_idea = gemini_model.enhance_idea(art_idea)
|
18 |
-
st.write("Enhanced Idea:", enhanced_idea)
|
19 |
-
with st.spinner("Geneating an image..."):
|
20 |
-
image = image_generator.generate_image(enhanced_idea)
|
21 |
-
st.image(image, caption="Generated Art")
|
22 |
-
|
23 |
-
# Add a download button for the generated image
|
24 |
-
img_byte_arr = io.BytesIO()
|
25 |
-
image.save(img_byte_arr, format='PNG')
|
26 |
-
img_byte_arr = img_byte_arr.getvalue()
|
27 |
-
st.download_button(
|
28 |
-
label="Download",
|
29 |
-
data=img_byte_arr,
|
30 |
-
file_name="generated_art.png",
|
31 |
-
mime="image/png"
|
32 |
-
)
|
33 |
-
else:
|
34 |
st.error("Please enter an art idea!")
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from llm import Model
|
3 |
+
from image_engine import ImageGenerator
|
4 |
+
import io
|
5 |
+
|
6 |
+
# Instantiate the models
|
7 |
+
gemini_model = Model()
|
8 |
+
image_generator = ImageGenerator()
|
9 |
+
|
10 |
+
# Streamlit interface
|
11 |
+
st.title("AI Artist🎨")
|
12 |
+
art_idea = st.text_input("Enter your drawing idea:")
|
13 |
+
|
14 |
+
if st.button("Generate Art"):
|
15 |
+
if art_idea:
|
16 |
+
with st.spinner("Enhancing your idea..."):
|
17 |
+
enhanced_idea = gemini_model.enhance_idea(art_idea)
|
18 |
+
st.write("Enhanced Idea:", enhanced_idea)
|
19 |
+
with st.spinner("Geneating an image..."):
|
20 |
+
image = image_generator.generate_image(enhanced_idea)
|
21 |
+
st.image(image, caption="Generated Art")
|
22 |
+
|
23 |
+
# Add a download button for the generated image
|
24 |
+
img_byte_arr = io.BytesIO()
|
25 |
+
image.save(img_byte_arr, format='PNG')
|
26 |
+
img_byte_arr = img_byte_arr.getvalue()
|
27 |
+
st.download_button(
|
28 |
+
label="Download",
|
29 |
+
data=img_byte_arr,
|
30 |
+
file_name="generated_art.png",
|
31 |
+
mime="image/png"
|
32 |
+
)
|
33 |
+
else:
|
34 |
st.error("Please enter an art idea!")
|