File size: 729 Bytes
b8cf2ad
5d56d38
b8cf2ad
5d56d38
2381e5b
b8cf2ad
2381e5b
 
 
 
 
b8cf2ad
2381e5b
b8cf2ad
2381e5b
 
5d56d38
b8cf2ad
decdace
5d56d38
2381e5b
 
 
 
5d56d38
2381e5b
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
import streamlit as st
from PIL import Image
import torch
from torchvision import transforms
from bk_sdm import BKSDMPipeline  # Hypothetical import; replace with actual model import

# Initialize the model
@st.cache_resource
def load_model():
    model = BKSDMPipeline.from_pretrained('path_to_bk_sdm_model')
    return model

model = load_model()

# Streamlit app interface
st.title("Text-to-Image Generation")
prompt = st.text_input("Enter a text prompt:")

if st.button("Generate Image"):
    if prompt:
        with st.spinner("Generating image..."):
            # Generate image
            image = model(prompt)
            st.image(image, caption="Generated Image")
    else:
        st.warning("Please enter a prompt.")