When using the Gradio Python client to upload an image, the handle_file() function is essential but often overlooked in the documentation. Here’s a quick example:

from gradio_client import Client, handle_file

client = Client("https://pragnakalp-ocr-image-to-text-zerogpu.hf.space/--replicas/zxswn/")
result = client.predict(
    'PaddleOCR',  
    handle_file(file_path),  # Path to your image file
    api_name="/predict",
)
print(result)

Key Point: Use handle_file() when uploading files for server-side processing. Without it, file uploads might not work correctly.