import gradio as gr from PIL import Image # This function receives image filepath from Gradio input and returns it as an image def receive_image(image_path): try: img = Image.open(image_path) return img except Exception as e: return f"Error reading image: {e}" # Gradio interface setup iface = gr.Interface( fn=receive_image, inputs=gr.Image(type="filepath", label="Upload Screenshot"), # ✅ fixed line outputs="image", title="Screen Watcher", description="This app receives and displays screenshots for analysis." ) iface.launch()