I have a spaces which will get image as input and gives output as text. I have build the interface with Gradio which works and now I want to use it as API, it shows me a curl command.
Eg.
curl -X POST https://kazeo57-image-processing.hf.space/gradio_api/call/image_processing -s -H "Content-Type: application/json" -d '{
"data": [
{"path":"https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png"},
"Négatif",
0,
3,
3,
3
]}' \
| awk -F'"' '{ print $4}' \
| read EVENT_ID; curl -N https://kazeo57-image-processing.hf.space/gradio_api/call/image_processing/$EVENT_ID
Which will first get the Event ID and then again pass a CURL to get the result.
I can get the Event ID but not the result I think the issue with file location
Error Logs
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 624, in process_events
response = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2015, in process_api
inputs = await self.preprocess_data(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1710, in preprocess_data
processed_input.append(block.preprocess(inputs_cached))
File "/usr/local/lib/python3.10/site-packages/gradio/components/image.py", line 228, in preprocess
im = PIL.Image.open(file_path)
File "/usr/local/lib/python3.10/site-packages/PIL/Image.py", line 3469, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/app/https:/example.com/image.png'