Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
-
import io
|
| 4 |
|
| 5 |
-
# This function receives image
|
| 6 |
-
def receive_image(
|
| 7 |
try:
|
| 8 |
-
img = Image.open(
|
| 9 |
-
return img
|
| 10 |
except Exception as e:
|
| 11 |
return f"Error reading image: {e}"
|
| 12 |
|
| 13 |
# Gradio interface setup
|
| 14 |
iface = gr.Interface(
|
| 15 |
fn=receive_image,
|
| 16 |
-
inputs=gr.Image(type="
|
| 17 |
outputs="image",
|
| 18 |
title="Screen Watcher",
|
| 19 |
description="This app receives and displays screenshots for analysis."
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
|
|
|
| 3 |
|
| 4 |
+
# This function receives image filepath from Gradio input and returns it as an image
|
| 5 |
+
def receive_image(image_path):
|
| 6 |
try:
|
| 7 |
+
img = Image.open(image_path)
|
| 8 |
+
return img
|
| 9 |
except Exception as e:
|
| 10 |
return f"Error reading image: {e}"
|
| 11 |
|
| 12 |
# Gradio interface setup
|
| 13 |
iface = gr.Interface(
|
| 14 |
fn=receive_image,
|
| 15 |
+
inputs=gr.Image(type="filepath", label="Upload Screenshot"), # ✅ fixed line
|
| 16 |
outputs="image",
|
| 17 |
title="Screen Watcher",
|
| 18 |
description="This app receives and displays screenshots for analysis."
|