Spaces:
No application file

app.py / App.py
Nickib2023's picture
Update app.py
85bdd6c verified
Raw History Blame Contribute Delete
1.12 kB
```python id="g7r5g0"
import gradio as gr
from PIL import Image, ImageDraw
import random
def generate_image(prompt):
width = 768
height = 768
img = Image.new(
"RGB",
(width, height),
color=(15, 15, 25)
)
draw = ImageDraw.Draw(img)
colors = [
(255, 0, 140),
(125, 44, 255),
(0, 255, 200),
(255, 120, 0),
]
for i in range(40):
x1 = random.randint(0, width)
y1 = random.randint(0, height)
x2 = random.randint(0, width)
y2 = random.randint(0, height)
draw.rectangle(
[x1, y1, x2, y2],
outline=random.choice(colors),
width=3
)
draw.text(
(30, 30),
prompt,
fill=(255, 255, 255)
)
return img
demo = gr.Interface(
fn=generate_image,
inputs=gr.Textbox(
label="Enter Prompt",
placeholder="luxury AI influencer photoshoot"
),
outputs=gr.Image(label="Generated Image"),
title="Squirt4Daddy AI Generator",
description="AI creator image generator demo"
)
demo.launch()
```