Spaces:
Runtime error
Runtime error
File size: 695 Bytes
b6d9d44 367b7eb b6d9d44 1462ea0 367b7eb b6d9d44 78e9d3f dc8b69f b6d9d44 dc8b69f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
# Используем официальную модель
model_id = "CompVis/stable-diffusion-v1-4"
# Загружаем модель без указания torch_dtype для работы на CPU
pipe = StableDiffusionPipeline.from_pretrained(model_id)
pipe.to("cpu") # Переносим модель на CPU
def generate_image(prompt):
image = pipe(prompt).images[0]
return image
# Запуск Gradio интерфейса с публичной ссылкой
gr.Interface(
fn=generate_image,
inputs="text",
outputs="image",
title="Stable Diffusion WebUI"
).launch(share=True)
|