Lambang commited on
Commit
b888137
·
1 Parent(s): 23cf5b4
Files changed (1) hide show
  1. main.py +16 -16
main.py CHANGED
@@ -115,19 +115,19 @@ async def upload_file(picture: UploadFile):
115
 
116
  return JSONResponse(content={'message': 'File successfully uploaded'}, status_code=200)
117
 
118
- # @app.get('/get_images', tags=["Predicting"])
119
- # def get_images():
120
- # folder_path = "./static/temporary"
121
- # files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))]
122
- # urls = []
123
- # for i in range(0, 3):
124
- # url = f'{public_url}/static/temporary/{files[i]}'
125
- # urls.append(url)
126
- # bentuk, persentase = data_train_pred.prediction(selected_model)
127
- # return {'urls': urls, 'bentuk_wajah':bentuk[0], 'persen':persentase}
128
-
129
- if __name__ == '__main__':
130
- import uvicorn
131
- public_url = ngrok.connect(8080).public_url
132
- print(f' * Running on {public_url}')
133
- uvicorn.run(app, host="0.0.0.0", port=8080)
 
115
 
116
  return JSONResponse(content={'message': 'File successfully uploaded'}, status_code=200)
117
 
118
+ @app.get('/get_images', tags=["Predicting"])
119
+ def get_images():
120
+ folder_path = "./static/temporary"
121
+ files = [f for f in os.listdir(folder_path) if os.path.isfile(os.path.join(folder_path, f))]
122
+ urls = []
123
+ for i in range(0, 3):
124
+ url = f'{public_url}/static/temporary/{files[i]}'
125
+ urls.append(url)
126
+ bentuk, persentase = data_train_pred.prediction(selected_model)
127
+ return {'urls': urls, 'bentuk_wajah':bentuk[0], 'persen':persentase}
128
+
129
+ # if __name__ == '__main__':
130
+ # import uvicorn
131
+ # public_url = ngrok.connect(8080).public_url
132
+ # print(f' * Running on {public_url}')
133
+ # uvicorn.run(app, host="0.0.0.0", port=8080)