File size: 618 Bytes
85b1295
 
 
30dbf30
e69418b
 
6db03a3
85b1295
e69418b
 
 
 
 
5d5fa27
e69418b
7d155ba
e69418b
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
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.json()
    
inp = gr.inputs.Image(type='file', label="Input Image")
output=gr.outputs.JSON(label='Response')
io=gr.Interface(fn=analysis, inputs=inp, outputs=output, title='Party Symbol Detector API',)
io.launch(debug=True,share=False)