File size: 458 Bytes
5358e44
93d7602
5358e44
2dbfe9e
 
3309eaa
37c4a8f
70bd3cf
 
3214141
 
2dbfe9e
93d7602
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import json
import gradio
import numpy as np
from model.model import Model

def main(list_encoded_image: str):
    image_array = np.array(json.loads(list_encoded_image), dtype=np.uint8)
    image = Model().detect_object(data=image_array)
    list_encoded_image = np.frombuffer(image, dtype=np.uint8).tolist()
    
    return json.dumps(list_encoded_image)

gradio_interface = gradio.Interface(fn=main, inputs="text", outputs="text")
gradio_interface.launch()