Spaces:
Runtime error
Runtime error
Benjamin Bossan
commited on
Commit
•
f9e5381
1
Parent(s):
66bc8ec
Remove commented code
Browse files- src/gistillery/ml.py +1 -21
src/gistillery/ml.py
CHANGED
@@ -140,6 +140,7 @@ class HfTransformersTagger(Tagger):
|
|
140 |
return sorted(tags)
|
141 |
|
142 |
def __call__(self, x: str) -> list[str]:
|
|
|
143 |
text = self.template.format(x)
|
144 |
inputs = self.tokenizer(text, return_tensors="pt")
|
145 |
outputs = self.model.generate(
|
@@ -182,24 +183,3 @@ class DefaultUrlProcessor(Processor):
|
|
182 |
assert isinstance(text, str)
|
183 |
text = self.template.format(url=self.url, content=text)
|
184 |
return text
|
185 |
-
|
186 |
-
|
187 |
-
# class ProcessorRegistry:
|
188 |
-
# def __init__(self) -> None:
|
189 |
-
# self.registry: list[Processor] = []
|
190 |
-
# self.default_registry: list[Processor] = []
|
191 |
-
# self.set_default_processors()
|
192 |
-
|
193 |
-
# def set_default_processors(self) -> None:
|
194 |
-
# self.default_registry.extend([PlainUrlProcessor(), RawProcessor()])
|
195 |
-
|
196 |
-
# def register(self, processor: Processor) -> None:
|
197 |
-
# self.registry.append(processor)
|
198 |
-
|
199 |
-
# def dispatch(self, input: JobInput) -> Processor:
|
200 |
-
# for processor in self.registry + self.default_registry:
|
201 |
-
# if processor.match(input):
|
202 |
-
# return processor
|
203 |
-
|
204 |
-
# # should never be requires, but eh
|
205 |
-
# return RawProcessor()
|
|
|
140 |
return sorted(tags)
|
141 |
|
142 |
def __call__(self, x: str) -> list[str]:
|
143 |
+
# should not return duplicates
|
144 |
text = self.template.format(x)
|
145 |
inputs = self.tokenizer(text, return_tensors="pt")
|
146 |
outputs = self.model.generate(
|
|
|
183 |
assert isinstance(text, str)
|
184 |
text = self.template.format(url=self.url, content=text)
|
185 |
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|