Krikoset commited on
Commit
1d6a9c5
1 Parent(s): 2eb53fc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ from PIL import Image
4
+
5
+ # Function to create an image with random pixels
6
+ def generate_random_image(num_pixels):
7
+ width, height = 100, 100 # Set the dimensions of the image (adjust as needed)
8
+ image = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)
9
+ image = Image.fromarray(image)
10
+ return image
11
+
12
+ # Gradio interface
13
+ iface = gr.Interface(
14
+ fn=generate_random_image,
15
+ inputs="number",
16
+ outputs="image",
17
+ title="Random Image Generator",
18
+ description="Enter the number of pixels to generate a random image.",
19
+ )
20
+
21
+ iface.launch()