Spaces:
Runtime error
Runtime error
File size: 1,287 Bytes
3f7b7d5 caf9a10 1774837 3f7b7d5 1774837 3f7b7d5 1774837 3f7b7d5 8f3c856 |
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 36 37 38 39 |
import gradio as gr
import spaces
import random
import torch
from diffusers import FluxPipeline
pipeline = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16)
pipeline.load_lora_weights("pepper13/fluxfw")
# pipeline.to("cuda")
@spaces.GPU(duration=70)
def generate(prompt):
pipe_end = pipeline(prompt=prompt, width=512, height=512, num_inference_steps=24, guidance_scale=7)
image = pipe_end.images[0]
return image
with open("main.css", "r") as link:
with gr.Blocks(css=link) as interface:
with gr.Column(elem_classes="interface-container"):
prompt = gr.Textbox(
label="Prompt",
info="Describe the image you want to generate.",
placeholder="e.g., Keanu Reeves holding a neon sign reading 'Hello, world!', 32k HDR, paparazzi",
# lines=1,
elem_classes="text-box"
)
generate_button = gr.Button("Generate Image", elem_classes="btn")
output = gr.Image(elem_classes="image-output")
generate_button.click(
fn=generate,
inputs=[prompt],
outputs=[output]
)
if __name__ == "__main__":
interface.launch() |