folder-classifier 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/PKG-INFO +1 -1
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier/classifier.py +9 -6
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier.egg-info/PKG-INFO +1 -1
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/setup.cfg +1 -1
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/README.md +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier/__init__.py +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier/app.py +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier/deploy.py +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier/dto.py +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier/util.py +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier.egg-info/SOURCES.txt +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier.egg-info/dependency_links.txt +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier.egg-info/top_level.txt +0 -0
- {folder_classifier-0.2.0 → folder_classifier-0.2.1}/pyproject.toml +0 -0
@@ -6,16 +6,19 @@ from transformers import pipeline
|
|
6
6
|
|
7
7
|
from folder_classifier.dto import Listing
|
8
8
|
|
9
|
-
classifier =
|
10
|
-
"zero-shot-classification",
|
11
|
-
model="MoritzLaurer/ModernBERT-large-zeroshot-v2.0",
|
12
|
-
torch_dtype=torch.bfloat16,
|
13
|
-
device="cuda"
|
14
|
-
)
|
9
|
+
classifier = None
|
15
10
|
|
16
11
|
candidate_labels = ["legal_matter", "other"]
|
17
12
|
|
18
13
|
def predict(listing: Listing) -> Tuple[str, float]:
|
14
|
+
global classifier
|
15
|
+
if classifier is None:
|
16
|
+
classifier = pipeline(
|
17
|
+
"zero-shot-classification",
|
18
|
+
model="MoritzLaurer/ModernBERT-large-zeroshot-v2.0",
|
19
|
+
torch_dtype=torch.bfloat16,
|
20
|
+
device="cuda"
|
21
|
+
)
|
19
22
|
text = "\n".join(listing.items)
|
20
23
|
hypothesis_template = "This list of files is about {}"
|
21
24
|
prediction = classifier(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier.egg-info/dependency_links.txt
RENAMED
File without changes
|
{folder_classifier-0.2.0 → folder_classifier-0.2.1}/folder_classifier.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|