File size: 1,132 Bytes
4e4e6a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e8f60b
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
31
32
33
34
import streamlit as st
from llm import Model
from image_engine import ImageGenerator
import io

# Instantiate the models
gemini_model = Model()
image_generator = ImageGenerator()

# Streamlit interface
st.title("AI Artist🎨")
art_idea = st.text_input("Enter your drawing idea:")

if st.button("Generate Art"):
    if art_idea:
        with st.spinner("Enhancing your idea..."):
            enhanced_idea = gemini_model.enhance_idea(art_idea)
            st.write("Enhanced Idea:", enhanced_idea)
        with st.spinner("Geneating an image..."):
            image = image_generator.generate_image(enhanced_idea)
            st.image(image, caption="Generated Art")
            
            # Add a download button for the generated image
            img_byte_arr = io.BytesIO()
            image.save(img_byte_arr, format='PNG')
            img_byte_arr = img_byte_arr.getvalue()
            st.download_button(
                label="Download",
                data=img_byte_arr,
                file_name="generated_art.png",
                mime="image/png"
            )
    else:
        st.error("Please enter an art idea!")