Spaces:
Runtime error
Runtime error
File size: 1,400 Bytes
f9d8d84 75a470f f9d8d84 | 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 40 41 42 43 44 45 46 47 48 49 50 51 52 | import gradio as gr
from models import generate_image
import spaces
with gr.Blocks(title="AI Text-to-Image Generator", theme=gr.themes.Soft()) as demo:
gr.Markdown("""
# AI Text-to-Image Generator
[Built with anycoder](https://huggingface.co/spaces/akhaliq/anycoder)
Generate images from text prompts using FLUX (fast generation).
""")
with gr.Row():
prompt = gr.Textbox(
label="Prompt",
placeholder="A beautiful sunset over mountains...",
lines=2
)
negative_prompt = gr.Textbox(
label="Negative Prompt (optional)",
placeholder="blurry, low quality, distorted",
lines=2
)
with gr.Row():
steps = gr.Slider(
label="Inference Steps",
minimum=1,
maximum=50,
value=20,
step=1
)
guidance_scale = gr.Slider(
label="Guidance Scale",
minimum=1.0,
maximum=20.0,
value=7.5,
step=0.5
)
generate_btn = gr.Button("Generate Image", variant="primary")
output_image = gr.Image(label="Generated Image")
generate_btn.click(
fn=generate_image,
inputs=[prompt, negative_prompt, steps, guidance_scale],
outputs=output_image
)
if __name__ == "__main__":
demo.launch() |