Dmitry Chaplinsky
commited on
Commit
•
f49bb16
1
Parent(s):
393ef8a
TRying to deploy
Browse files- README.md +11 -0
- pipeline.py +22 -0
- requirements.txt +1 -0
README.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- uk
|
4 |
+
tags:
|
5 |
+
- text2text-generation
|
6 |
+
- gensim
|
7 |
+
library_name: generic
|
8 |
license: mit
|
9 |
+
datasets:
|
10 |
+
- ubertext1.0
|
11 |
+
widget:
|
12 |
+
- text: "Подорож"
|
13 |
+
- text: "Голова"
|
14 |
---
|
pipeline.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gensim
|
2 |
+
from typing import List, Dict
|
3 |
+
|
4 |
+
|
5 |
+
class PreTrainedPipeline:
|
6 |
+
def __init__(self, path=""):
|
7 |
+
from huggingface_hub import hf_hub_download
|
8 |
+
|
9 |
+
self.model = gensim.models.Word2Vec.load(
|
10 |
+
hf_hub_download(repo_id="lang-uk/word2vec-uk", filename="ubercorpus.cased.tokenized.300d")
|
11 |
+
)
|
12 |
+
|
13 |
+
def __call__(self, inputs: str) -> List[Dict]:
|
14 |
+
"""
|
15 |
+
Args:
|
16 |
+
inputs (:obj:`str`):
|
17 |
+
a string containing some text
|
18 |
+
Return:
|
19 |
+
A :obj:`str`
|
20 |
+
"""
|
21 |
+
inputs = inputs.strip()
|
22 |
+
return [{"generated_text": str(self.model.wv.most_similar(inputs))}]
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
gensim
|