Spaces:
Sleeping
Sleeping
dinhquangson
commited on
Commit
•
c1c1c06
1
Parent(s):
d020550
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,12 @@ from modelscope.pipelines import pipeline
|
|
5 |
from modelscope.utils.constant import Tasks
|
6 |
from os import makedirs,getcwd
|
7 |
from os.path import join,exists,dirname
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
lineless_table_recognition = pipeline(Tasks.lineless_table_recognition, model='damo/cv_resnet-transformer_table-structure-recognition_lore')
|
10 |
-
|
11 |
app = FastAPI()
|
12 |
parent_path = dirname(getcwd())
|
13 |
|
@@ -21,6 +24,14 @@ def pdf2images(file: UploadFile=File(...)):
|
|
21 |
|
22 |
with open(file_savePath,'wb') as f:
|
23 |
shutil.copyfileobj(file.file, f)
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
|
|
|
|
26 |
return result
|
|
|
5 |
from modelscope.utils.constant import Tasks
|
6 |
from os import makedirs,getcwd
|
7 |
from os.path import join,exists,dirname
|
8 |
+
from modelscope.models import Model
|
9 |
+
from modelscope.pipelines import pipeline
|
10 |
+
|
11 |
+
model = Model.from_pretrained('damo/multi-modal_convnext-roberta-base_vldoc-embedding')
|
12 |
+
doc_VL_emb_pipeline = pipeline(task='document-vl-embedding', model=model)
|
13 |
|
|
|
|
|
14 |
app = FastAPI()
|
15 |
parent_path = dirname(getcwd())
|
16 |
|
|
|
24 |
|
25 |
with open(file_savePath,'wb') as f:
|
26 |
shutil.copyfileobj(file.file, f)
|
27 |
+
|
28 |
+
inp = {
|
29 |
+
'images': ['/demo.png'],
|
30 |
+
'ocr_info_paths': ['/demo.json']
|
31 |
+
}
|
32 |
+
result = doc_VL_emb_pipeline(inp)
|
33 |
|
34 |
+
print('Results of VLDoc: ')
|
35 |
+
for k, v in result.items():
|
36 |
+
print(f'{k}: {v.size()}')
|
37 |
return result
|