|
import gradio as gr |
|
import random |
|
|
|
def get_image_url(prompt, width=512, height=512): |
|
seed = random.randint(1000, 999999) |
|
url = f"https://image.pollinations.ai/prompt/{prompt}?model=flux&seed={seed}&width={width}&height={height}&nologo=true" |
|
return url |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("### 🔗 [Ai image generator Free](https://aiimage.uno)") |
|
gr.Markdown("## 🎨 Text-to-Image Flux pro") |
|
|
|
with gr.Row(): |
|
prompt = gr.Textbox(label="Prompt", placeholder="e.g. Happy Diwali poster") |
|
|
|
with gr.Row(): |
|
width = gr.Slider(256, 1920, value=512, step=64, label="Width") |
|
height = gr.Slider(256, 1080, value=512, step=64, label="Height") |
|
|
|
btn = gr.Button("Generate Image") |
|
output = gr.Image(type="filepath", label="Generated Image") |
|
|
|
btn.click(fn=get_image_url, inputs=[prompt, width, height], outputs=output) |
|
|
|
demo.launch() |
|
|