Percy3822 commited on
Commit
3145935
·
verified ·
1 Parent(s): 7ffe7f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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 bytes from your local screenshot sender
6
- def receive_image(file):
7
  try:
8
- img = Image.open(file)
9
- return img # Display image on the interface
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="file", label="Upload Screenshot"),
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."