haoyu commited on
Commit
b19e824
1 Parent(s): fd4ecc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -30,7 +30,7 @@ if authentication_status:
30
  st.text("上传彩色苹果叶子图片")
31
 
32
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
33
- pipe = pipe.to("cuda")
34
 
35
 
36
  uploaded_file = st.file_uploader("选择..", type=["jpg","png","jpeg"])
@@ -39,7 +39,8 @@ if authentication_status:
39
  st.image(image, caption='上传了图片。', use_column_width=True)
40
  st.write("")
41
  st.write("分类...")
42
- generator = torch.Generator("cuda").manual_seed(1024)
 
43
 
44
  image_gen = pipe(prompt, generator=generator).images[0]
45
  st.image(generator)
 
30
  st.text("上传彩色苹果叶子图片")
31
 
32
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
33
+ pipe = pipe.to("cpu")#("cuda")
34
 
35
 
36
  uploaded_file = st.file_uploader("选择..", type=["jpg","png","jpeg"])
 
39
  st.image(image, caption='上传了图片。', use_column_width=True)
40
  st.write("")
41
  st.write("分类...")
42
+ # generator = torch.Generator("cuda").manual_seed(1024)
43
+ generator = torch.Generator().manual_seed(1024)
44
 
45
  image_gen = pipe(prompt, generator=generator).images[0]
46
  st.image(generator)