File size: 962 Bytes
73bdead 8f58a8f 63c8171 e081663 63c8171 edac864 e081663 edac864 8f58a8f e081663 73bdead e081663 63c8171 b7e7659 |
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 |
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 # Direct image URL, no server fetch
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") # Image will load from URL
btn.click(fn=get_image_url, inputs=[prompt, width, height], outputs=output)
demo.launch()
|