shamaayan commited on
Commit
addf785
โ€ข
1 Parent(s): cdc69bb

register pipeline

Browse files
Files changed (1) hide show
  1. register.py +16 -0
register.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoModel, AutoTokenizer, pipeline
2
+ from transformers.pipelines import PIPELINE_REGISTRY
3
+
4
+ from hive_token_classification import HiveTokenClassification
5
+
6
+
7
+ PIPELINE_REGISTRY.register_pipeline(
8
+ "hive-token-classification",
9
+ pipeline_class=HiveTokenClassification,
10
+ pt_model=AutoModel
11
+ )
12
+
13
+ pipe = pipeline(task='hive-token-classification', model='Hiveurban/dictabert-large-parse', trust_remote_code=True)
14
+ print(pipe(["ื‘ืฉื ืช 1948 ื”ืฉืœื™ื ืืคืจื™ื ืงื™ืฉื•ืŸ ืืช ืœื™ืžื•ื“ื™ื• ื‘ืคื™ืกื•ืœ ืžืชื›ืช ื•ื‘ืชื•ืœื“ื•ืช ื”ืืžื ื•ืช ื•ื”ื—ืœ ืœืคืจืกื ืžืืžืจื™ื ื”ื•ืžื•ืจื™ืกื˜ื™ื™ื"]))
15
+
16
+ pipe.push_to_hub('hive-token-classification')