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]}) | |
| return r | |
| inp = gr.inputs.Image(type='file', label="Input Image") | |
| output=gr.outputs.JSON(label='Response') | |
| io=gr.Interface(fn=detect, inputs=inp, outputs=output, title='Party Symbol Detector API',) | |
| io.launch(debug=True,share=False) | |