Spaces:
Runtime error
Runtime error
File size: 765 Bytes
a72233c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import torch
import gradio as gr
from diffusers import DiffusionPipeline
MODEL_ID = "black-forest-labs/FLUX.1-schnell"
# Pipeline laden (CPU)
pipe = DiffusionPipeline.from_pretrained(
MODEL_ID,
torch_dtype=torch.float32
)
pipe.to("cpu")
def generate(prompt):
image = pipe(
prompt=prompt,
num_inference_steps=20,
guidance_scale=3.5
).images[0]
return image
demo = gr.Interface(
fn=generate,
inputs=gr.Textbox(
label="Prompt",
placeholder="anime girl with fennec ears sitting on a log in the woods"
),
outputs=gr.Image(type="pil"),
title="FLUX Text-to-Image (CPU Space)",
description="Runs on CPU using diffusers. Slow but works."
)
if __name__ == "__main__":
demo.launch()
|