Explorar o código

fix model_dir, add en_ppocr_table_model

zeke-chin %!s(int64=2) %!d(string=hai) anos
pai
achega
d046d2d764

BIN=BIN
en_ppocr_mobile_v2.0_table_structure_infer/inference.pdiparams


BIN=BIN
en_ppocr_mobile_v2.0_table_structure_infer/inference.pdiparams.info


BIN=BIN
en_ppocr_mobile_v2.0_table_structure_infer/inference.pdmodel


+ 11 - 0
run.py

@@ -0,0 +1,11 @@
+if __name__ == '__main__':
+    import uvicorn
+    import argparse
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--host', default='0.0.0.0')
+    parser.add_argument('--port', default=8080)
+    opt = parser.parse_args()
+
+    app_str = 'server:app'  # make the app string equal to whatever the name of this file is
+    uvicorn.run(app_str, host=opt.host, port=int(opt.port), reload=True)

+ 5 - 1
server.py

@@ -31,7 +31,11 @@ if os.getenv('USE_CUDA') == 'gpu':
 print(f'use gpu: {use_gpu}')
 
 # 初始化模型
-table_engine = PPStructure(layout=False, table=True, show_log=True, table_model_dir="./tabel_ocr_infer")
+table_engine = PPStructure(layout=False,
+                           table=True,
+                           use_gpu=use_gpu,
+                           show_log=True,
+                           table_model_dir="./tabel_ocr_infer")
 
 
 class TableInfo(BaseModel):