Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,9 +12,7 @@ from authtoken import auth_token
|
|
| 12 |
|
| 13 |
# Download stable diffusion model from Hugging Face
|
| 14 |
modelid = "CompVis/stable-diffusion-v1-4"
|
| 15 |
-
device = "cuda"
|
| 16 |
stable_diffusion_model = StableDiffusionPipeline.from_pretrained(modelid, revision="fp16", torch_dtype=torch.float16, use_auth_token=auth_token)
|
| 17 |
-
stable_diffusion_model.to(device)
|
| 18 |
|
| 19 |
# Create a Streamlit app
|
| 20 |
st.set_page_config(
|
|
@@ -35,7 +33,7 @@ def generate_image():
|
|
| 35 |
if prompt:
|
| 36 |
st.write("Generating image...")
|
| 37 |
try:
|
| 38 |
-
with autocast(
|
| 39 |
image = stable_diffusion_model(prompt, guidance_scale=8.5)["sample"][0]
|
| 40 |
|
| 41 |
# Display the generated image on the user interface
|
|
|
|
| 12 |
|
| 13 |
# Download stable diffusion model from Hugging Face
|
| 14 |
modelid = "CompVis/stable-diffusion-v1-4"
|
|
|
|
| 15 |
stable_diffusion_model = StableDiffusionPipeline.from_pretrained(modelid, revision="fp16", torch_dtype=torch.float16, use_auth_token=auth_token)
|
|
|
|
| 16 |
|
| 17 |
# Create a Streamlit app
|
| 18 |
st.set_page_config(
|
|
|
|
| 33 |
if prompt:
|
| 34 |
st.write("Generating image...")
|
| 35 |
try:
|
| 36 |
+
with autocast():
|
| 37 |
image = stable_diffusion_model(prompt, guidance_scale=8.5)["sample"][0]
|
| 38 |
|
| 39 |
# Display the generated image on the user interface
|