Spaces:
Runtime error
Runtime error
File size: 2,898 Bytes
ee6e95a |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
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() |