man08man commited on
Commit
68fe6d7
·
verified ·
1 Parent(s): 6abdb3d

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +17 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ # Load the model
6
+ model_id = "runwayml/stable-diffusion-v1-5"
7
+ pipe = StableDiffusionPipeline.from_pretrained(model_id)
8
+ pipe = pipe.to("cuda") # Runs on Hugging Face's GPU servers
9
+
10
+ # Streamlit UI
11
+ st.title("Free AI Image Generator")
12
+ prompt = st.text_input("Describe your image...")
13
+
14
+ if prompt:
15
+ with st.spinner("Generating..."):
16
+ image = pipe(prompt).images[0]
17
+ st.image(image, caption=prompt, use_column_width=True)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ diffusers
2
+ transformers
3
+ accelerate
4
+ torch
5
+ streamlit