Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import random | |
| from PIL import Image | |
| import io | |
| # Dummy functions to simulate image generation models | |
| def ideogram_2_0_turbo(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def midjourney_6_1(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def flux_1_1_dev(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def flux_1_1_pro(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def flux_1_1_pro_ultra(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def dall_e_3_0(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def stable_diffusion_3_5_large(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| def imggen_3_0(prompt): | |
| # Simulate image generation by creating a random image | |
| img = Image.new('RGB', (256, 256), color=(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) | |
| return img | |
| # Function to generate images using all models | |
| def generate_images(prompt): | |
| images = [] | |
| images.append(ideogram_2_0_turbo(prompt)) | |
| images.append(midjourney_6_1(prompt)) | |
| images.append(flux_1_1_dev(prompt)) | |
| images.append(flux_1_1_pro(prompt)) | |
| images.append(flux_1_1_pro_ultra(prompt)) | |
| images.append(dall_e_3_0(prompt)) | |
| images.append(stable_diffusion_3_5_large(prompt)) | |
| images.append(imggen_3_0(prompt)) | |
| return images | |
| # Create the Gradio interface | |
| with gr.Blocks() as iface: | |
| gr.Markdown("# Image Generation by All Models") | |
| gr.Markdown("Enter a prompt to generate images using different models.") | |
| with gr.Row(): | |
| prompt_input = gr.Textbox(label="Prompt") | |
| btn_generate = gr.Button("Generate Images") | |
| with gr.Row(): | |
| image_outputs = [gr.Image(label=f"Model {i+1}") for i in range(8)] | |
| btn_generate.click(generate_images, inputs=prompt_input, outputs=image_outputs) | |
| # Launch the interface | |
| iface.launch() |