haya-alwarthan commited on
Commit
b1b8d73
·
1 Parent(s): 6c15af8
Files changed (1) hide show
  1. app.py +31 -4
app.py CHANGED
@@ -1,7 +1,34 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text", _api_mode=True)
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import cv2
3
 
4
+ def predict_fn(img_path):
5
+ #Read and tranform input image
6
+ # preds=model.predict(img_path).json()
7
+ og_img=cv2.imread(img_path)
8
+ # img=binary_cv2(og_img,preds)
9
+ # outputs = kp_predictor(img) # format is documented at https://detectron2.readthedocs.io/tutorials/models.html#model-output-format
10
+ # print("outputs==".format(outputs["instances"].to("cpu")))
11
+ # p=np.asarray(outputs["instances"].to("cpu").pred_keypoints, dtype='float32')[0].reshape(-1)
12
+ # pairss=convert_to_pairs(p)
13
+ # segm=segm_imf(preds,og_img)
14
+ # output=visualize(segm,pairss)
15
+ return og_img
16
 
17
+
18
+
19
+ inputs_image = [
20
+ gr.components.Image(type="filepath", label="Upload an XRay Image of the Pelvis"),
21
+ ]
22
+ outputs_image = [
23
+ gr.components.Image(type="numpy", label="Output Image")
24
+ ]
25
+
26
+
27
+
28
+ gr.Interface(
29
+ predict_fn,
30
+ inputs=inputs_image,
31
+ outputs=outputs_image,
32
+ title="Coordinates of the Landmarks",
33
+ _api_mode=True
34
+ ).launch()