import os import random import requests import gradio as gr from io import BytesIO def generate_image(prompt, width, height, seed, randomize): if randomize: seed = random.randint(0, 99999) base_url = os.environ.get("FLUX_URL") if not base_url: return "Error: FLUX_URL environment variable not set." url = ( base_url.replace("[prompt]", prompt) .replace("[w]", str(width)) .replace("[h]", str(height)) .replace("[seed]", str(seed)) ) response = requests.get(url) return BytesIO(response.content) title = "Unlimited FLUX-Pro" description = "Here you can use the FLUX-Pro as much as you want without limits" iface = gr.Interface( fn=generate_image, inputs=[ gr.Textbox(label="Prompt", placeholder="Enter your image prompt..."), gr.Slider(minimum=100, maximum=1024, step=1, value=512, label="Width"), gr.Slider(minimum=100, maximum=1024, step=1, value=512, label="Height"), gr.Number(label="Seed", value=0), gr.Checkbox(label="Randomize Seed") ], outputs=gr.Image(type="pil"), title=title, description=description, ) if __name__ == "__main__": iface.launch()