Testertesting / app.py
DetectiveShadow's picture
Update app.py
89303e0 verified
raw
history blame contribute delete
899 Bytes
import streamlit as st
st.title("👋 Hello Coders at MVP")
st.write("Welcome to your Hugging Face Space!")
import torch
from diffusers import DiffusionPipeline
@st.cache_resource
def load_pipe():
pipe = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
torch_dtype=torch.float16,
variant="fp16",
use_safetensors=True
).to("cuda")
pipe.load_lora_weights("ZB-Tech/Text-to-Image")
return pipe
st.title("🎨 AI Image Generator")
prompt = st.text_input("Enter a prompt:", "Draw a picture of some coding on a screen with a horror background")
if st.button("Generate"):
with st.spinner("Generating image..."):
pipe = load_pipe()
image = pipe(prompt).images[0]
st.image(image, caption="Generated Image", use_column_width=True)
x = st.slider('Select a value')
st.write(x, 'squared is', x * x)