Spaces:
Runtime error
Runtime error
nitial commit for Stable Diffusion WebUI" (Начальный коммит для веб-интерфейса Stable Diffusion).
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import StableDiffusionPipeline
|
| 3 |
+
|
| 4 |
+
# Загрузка модели с Hugging Face
|
| 5 |
+
model_id = "lllyasviel/flux1_dev"
|
| 6 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 7 |
+
|
| 8 |
+
def generate_image(prompt):
|
| 9 |
+
image = pipe(prompt).images[0]
|
| 10 |
+
return image
|
| 11 |
+
|
| 12 |
+
gr.Interface(
|
| 13 |
+
fn=generate_image,
|
| 14 |
+
inputs="text",
|
| 15 |
+
outputs="image",
|
| 16 |
+
title="Stable Diffusion WebUI"
|
| 17 |
+
).launch()
|