File size: 885 Bytes
ed4033a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from models import load_model, generate_image

# Load the model on startup
pipe = load_model()

def text_to_image(prompt):
    return generate_image(pipe, prompt)

with gr.Blocks(title="AI Text-to-Image Generator") as demo:
    gr.Markdown("# AI Text-to-Image Generator\nBuilt with [anycoder](https://huggingface.co/spaces/akhaliq/anycoder)")
    gr.Markdown("Generate images from text prompts using FLUX.1-dev model.")
    
    prompt_input = gr.Textbox(
        label="Enter your prompt",
        placeholder="A beautiful landscape with mountains and a lake...",
        lines=3
    )
    
    generate_btn = gr.Button("Generate Image")
    
    output_image = gr.Image(label="Generated Image")
    
    generate_btn.click(
        fn=text_to_image,
        inputs=[prompt_input],
        outputs=[output_image]
    )

if __name__ == "__main__":
    demo.launch()