pixelC / app.py
Krikoset's picture
Create app.py
1d6a9c5
raw
history blame
No virus
601 Bytes
import gradio as gr
import numpy as np
from PIL import Image
# Function to create an image with random pixels
def generate_random_image(num_pixels):
width, height = 100, 100 # Set the dimensions of the image (adjust as needed)
image = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
image = Image.fromarray(image)
return image
# Gradio interface
iface = gr.Interface(
fn=generate_random_image,
inputs="number",
outputs="image",
title="Random Image Generator",
description="Enter the number of pixels to generate a random image.",
)
iface.launch()