folder-classifier 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

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.
@@ -6,16 +6,19 @@ from transformers import pipeline
6
6
 
7
7
  from folder_classifier.dto import Listing
8
8
 
9
- classifier = pipeline(
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(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: folder-classifier
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Deploy folder classifier API to a Ray cluster
5
5
  Author: Crispin Almodovar
6
6
  Author-email:
@@ -1,10 +1,10 @@
1
1
  folder_classifier/__init__.py,sha256=k0YWZyUNe7myJiKeX0OaXtJ30_3EGE-vsZiAUbqa-3E,46
2
2
  folder_classifier/app.py,sha256=FqoBp_KQ3yIfoHTagdDTVsLbIj8luCn7en533Q870x8,1443
3
- folder_classifier/classifier.py,sha256=zgkji_FfWILAvf6yN56doVF917Nx6lOrWhDw4hYoJ-k,947
3
+ folder_classifier/classifier.py,sha256=vt7LxIKpzGcB-74epsQKrEg6CfPuJnoRsQ-qIkO7r8o,1062
4
4
  folder_classifier/deploy.py,sha256=UQTbQjR_JX92Xo8L5EbK4nPg_VJmwWDmzMQSjP3-7iQ,412
5
5
  folder_classifier/dto.py,sha256=WFWkYUVn5rrAowObBlMyacbgzHB30km0Y4vsAPjOULc,1326
6
6
  folder_classifier/util.py,sha256=t-ma2suHovfNutogJb9jailRbRpIg4qv-zph3dHb2og,692
7
- folder_classifier-0.2.0.dist-info/METADATA,sha256=Hfln_xbCUIhoV5CzZr0i2uKPXhMtILZLwMxknyOlc9Q,392
8
- folder_classifier-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- folder_classifier-0.2.0.dist-info/top_level.txt,sha256=36ugc9pEbNQ-mnzz4Ot2WVjY3t_LzAN6XOCjDFP4p4k,18
10
- folder_classifier-0.2.0.dist-info/RECORD,,
7
+ folder_classifier-0.2.1.dist-info/METADATA,sha256=8vaTYk8ZVnqcmZaNAs3AiC9iWXV4XopeuFlquj5CiBg,392
8
+ folder_classifier-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ folder_classifier-0.2.1.dist-info/top_level.txt,sha256=36ugc9pEbNQ-mnzz4Ot2WVjY3t_LzAN6XOCjDFP4p4k,18
10
+ folder_classifier-0.2.1.dist-info/RECORD,,