-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (30 loc) · 1.17 KB
/
Copy pathapp.py
File metadata and controls
35 lines (30 loc) · 1.17 KB
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
from flask import Flask
import tooth_segmenter
import os
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, This is 3D Tooth Segmentation API!</p>"
@app.route("/segment/<string:type_object>/<string:pred_option>/<path:path_file>")
def segment(type_object,pred_option, path_file):
tooth_segmenter.segment(type_object, pred_option, path_file)
if(pred_option=='all'):
return {
'downsampling': os.path.join(os.getcwd(),'saved','out_downsampling.vtp'),
'downsampling_refined': os.path.join(os.getcwd(),'saved','out_downsampling_refined.vtp'),
'refined': os.path.join(os.getcwd(),'saved','out_refined.vtp')
}
if(pred_option=='d'):
return {
'downsampling': os.path.join(os.getcwd(),'saved','out_downsampling.vtp'),
}
if(pred_option=='d_r'):
return {
'downsampling_refined': os.path.join(os.getcwd(),'saved','out_downsampling_refined.vtp'),
}
if(pred_option=='r'):
return {
'refined': os.path.join(os.getcwd(),'saved','out_refined.vtp')
}
else:
raise ValueError('Prediction option is not exist.')