Kitasurfer commited on
Commit
1462ea0
·
verified ·
1 Parent(s): b6d9d44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -4,13 +4,16 @@ import torch
4
 
5
  # Используем официальную модель
6
  model_id = "CompVis/stable-diffusion-v1-4"
7
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
8
- pipe.to("cuda" if torch.cuda.is_available() else "cpu")
 
 
9
 
10
  def generate_image(prompt):
11
  image = pipe(prompt).images[0]
12
  return image
13
 
 
14
  gr.Interface(
15
  fn=generate_image,
16
  inputs="text",
 
4
 
5
  # Используем официальную модель
6
  model_id = "CompVis/stable-diffusion-v1-4"
7
+
8
+ # Загружаем модель без указания torch_dtype для работы на CPU
9
+ pipe = StableDiffusionPipeline.from_pretrained(model_id)
10
+ pipe.to("cpu") # Переносим модель на CPU
11
 
12
  def generate_image(prompt):
13
  image = pipe(prompt).images[0]
14
  return image
15
 
16
+ # Запуск Gradio интерфейса
17
  gr.Interface(
18
  fn=generate_image,
19
  inputs="text",