Update app.py
Browse files
app.py
CHANGED
|
@@ -5,22 +5,8 @@ import numpy as np
|
|
| 5 |
|
| 6 |
def process_image(input_image):
|
| 7 |
# Get image size in KB
|
| 8 |
-
img_size_kb = os.path.getsize(input_image) / 1024
|
| 9 |
|
| 10 |
-
|
| 11 |
-
size = 300
|
| 12 |
-
if img_size_kb > 500:
|
| 13 |
-
# Green square for large images
|
| 14 |
-
color = [0, 255, 0] # RGB for green
|
| 15 |
-
else:
|
| 16 |
-
# Black square for small images
|
| 17 |
-
color = [0, 0, 0] # RGB for black
|
| 18 |
-
|
| 19 |
-
# Create numpy array with the specified color
|
| 20 |
-
array = np.zeros((size, size, 3), dtype=np.uint8)
|
| 21 |
-
array[:, :] = color
|
| 22 |
-
|
| 23 |
-
return Image.fromarray(array)
|
| 24 |
|
| 25 |
# Create Gradio interface
|
| 26 |
with gr.Blocks() as demo:
|
|
|
|
| 5 |
|
| 6 |
def process_image(input_image):
|
| 7 |
# Get image size in KB
|
|
|
|
| 8 |
|
| 9 |
+
return input_image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# Create Gradio interface
|
| 12 |
with gr.Blocks() as demo:
|