meraj12 commited on
Commit
582aa2c
·
verified ·
1 Parent(s): 65ba311

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -1,8 +1,34 @@
1
  # app.py
 
 
 
 
 
2
  import streamlit as st
3
  from diffusers import StableDiffusionPipeline
4
  import torch
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # Add this at the top of your app.py
7
  import warnings
8
  warnings.filterwarnings("ignore", message="cached_download is deprecated")
 
1
  # app.py
2
+ #Add before any other imports
3
+ from huggingface_hub import cached_download, hf_hub_download
4
+ import warnings
5
+ warnings.filterwarnings("ignore", category=DeprecationWarning)
6
+
7
  import streamlit as st
8
  from diffusers import StableDiffusionPipeline
9
  import torch
10
 
11
+ import streamlit as st
12
+ import torch
13
+ from diffusers import StableDiffusionPipeline
14
+
15
+
16
+ # Model configuration
17
+ MODEL_ID = "CompVis/stable-diffusion-v1-4"
18
+
19
+ @st.cache_resource(show_spinner=False)
20
+ def load_model():
21
+ return StableDiffusionPipeline.from_pretrained(
22
+ MODEL_ID,
23
+ torch_dtype=torch.float32,
24
+ use_auth_token=False,
25
+ revision="fp16",
26
+ use_safetensors=False, # Force use of .bin files
27
+ custom_pipeline="stable_diffusion",
28
+ safety_checker=None
29
+ ).to("cpu")
30
+
31
+ # Rest of your Streamlit code remains the same...
32
  # Add this at the top of your app.py
33
  import warnings
34
  warnings.filterwarnings("ignore", message="cached_download is deprecated")