Spaces:
Runtime error
Runtime error
""" | |
Run a rest API exposing the yolov5s object detection model | |
""" | |
import gradio as gr | |
import requests | |
def detect(inp): | |
filename=inp | |
bs64Data=gr.processing_utils.encode_file_to_base64(filename) | |
r = requests.post(url='https://hf.space/gradioiframe/Sa-m/Political-Party-Symbol-Detector-V1/+/api/predict/', | |
json={"data": [bs64Data]}) | |
res= r.json() | |
res['data']='hidden since it is a large base64 file' | |
return res | |
inp = gr.inputs.Image(type='filepath', label="Input Image") | |
output=gr.outputs.JSON(label='Response') | |
io=gr.Interface(fn=detect, inputs=inp, outputs=output, title='Party Symbol Detector API',examples=['8.jpg','24.jpg']) | |
io.launch(debug=True,share=False) | |