Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,16 @@ import torch
|
|
| 4 |
|
| 5 |
# Используем официальную модель
|
| 6 |
model_id = "CompVis/stable-diffusion-v1-4"
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
| 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",
|