File size: 969 Bytes
8a17393
b1b8d73
8a17393
b1b8d73
 
 
 
 
 
 
 
 
 
 
 
8a17393
b1b8d73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gradio as gr
import cv2

def predict_fn(img_path):
    #Read and tranform input image
    # preds=model.predict(img_path).json()
    og_img=cv2.imread(img_path)
    # img=binary_cv2(og_img,preds)
    # outputs = kp_predictor(img)  # format is documented at https://detectron2.readthedocs.io/tutorials/models.html#model-output-format
    # print("outputs==".format(outputs["instances"].to("cpu")))
    # p=np.asarray(outputs["instances"].to("cpu").pred_keypoints, dtype='float32')[0].reshape(-1)
    # pairss=convert_to_pairs(p)
    # segm=segm_imf(preds,og_img)
    # output=visualize(segm,pairss)
    return og_img



inputs_image = [
    gr.components.Image(type="filepath", label="Upload an XRay Image of the Pelvis"),
]
outputs_image = [
    gr.components.Image(type="numpy", label="Output Image")
] 



gr.Interface(
    predict_fn,
    inputs=inputs_image,
    outputs=outputs_image,
    title="Coordinates of the Landmarks",
    _api_mode=True
).launch()