Gleb Vinarskis commited on
Commit
6935b09
·
1 Parent(s): efd034d

initial commit

Browse files
Files changed (3) hide show
  1. OCR_score.py +12 -0
  2. floret_language_recognition.py +16 -0
  3. floret_model.bin +3 -0
OCR_score.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import hf_hub_download
2
+
3
+ class FloretPipeline:
4
+ def __init__(self, language=None):
5
+ if language == None:
6
+ exec(open(hf_hub_download("Maslionok/pipeline1", "test.py")).read())
7
+
8
+
9
+
10
+ def __call__(self, text):
11
+ output = self.model.predict(text, k=1)
12
+ return output
floret_language_recognition.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import hf_hub_download
2
+ import floret
3
+
4
+ class FloretPipeline:
5
+ def __init__(self, model_name="floret_model.bin", repo_id="Maslionok/sudo_pipelines", revision="main"):
6
+ model_path = hf_hub_download(repo_id=repo_id, filename=model_name, revision=revision)
7
+ self.model = floret.load_model(model_path)
8
+
9
+ def __call__(self, text):
10
+ output = self.model.predict(text, k=1)
11
+ language, value = output
12
+
13
+ return language
14
+
15
+ # Auto-load the model when the script is imported
16
+ floret_model = FloretPipeline()
floret_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:987a2e16b216eb22f0342beb75874e9748cf6bceeb4ac75f6e2efc3414e74961
3
+ size 32001553