Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
·
09c3b82
1
Parent(s):
07bed83
Update app.py
Browse files
app.py
CHANGED
@@ -79,7 +79,7 @@ class GradioInference:
|
|
79 |
#### Prueba
|
80 |
WHITESPACE_HANDLER = lambda k: re.sub('\s+', ' ', re.sub('\n+', ' ', k.strip()))
|
81 |
|
82 |
-
|
83 |
[WHITESPACE_HANDLER(results["text"])],
|
84 |
return_tensors="pt",
|
85 |
padding="max_length",
|
@@ -87,15 +87,15 @@ class GradioInference:
|
|
87 |
max_length=512
|
88 |
)["input_ids"]
|
89 |
|
90 |
-
|
91 |
-
input_ids=
|
92 |
max_length=130,
|
93 |
no_repeat_ngram_size=2,
|
94 |
num_beams=4
|
95 |
)[0]
|
96 |
|
97 |
-
summary = tokenizer.decode(
|
98 |
-
|
99 |
skip_special_tokens=True,
|
100 |
clean_up_tokenization_spaces=False
|
101 |
)
|
@@ -167,7 +167,7 @@ class GradioInference:
|
|
167 |
#### Prueba
|
168 |
WHITESPACE_HANDLER = lambda k: re.sub('\s+', ' ', re.sub('\n+', ' ', k.strip()))
|
169 |
|
170 |
-
|
171 |
[WHITESPACE_HANDLER(results["text"])],
|
172 |
return_tensors="pt",
|
173 |
padding="max_length",
|
@@ -175,15 +175,15 @@ class GradioInference:
|
|
175 |
max_length=512
|
176 |
)["input_ids"]
|
177 |
|
178 |
-
|
179 |
-
input_ids=
|
180 |
max_length=130,
|
181 |
no_repeat_ngram_size=2,
|
182 |
num_beams=4
|
183 |
)[0]
|
184 |
|
185 |
-
summary = tokenizer.decode(
|
186 |
-
|
187 |
skip_special_tokens=True,
|
188 |
clean_up_tokenization_spaces=False
|
189 |
)
|
|
|
79 |
#### Prueba
|
80 |
WHITESPACE_HANDLER = lambda k: re.sub('\s+', ' ', re.sub('\n+', ' ', k.strip()))
|
81 |
|
82 |
+
input_ids_sum = self.tokenizer(
|
83 |
[WHITESPACE_HANDLER(results["text"])],
|
84 |
return_tensors="pt",
|
85 |
padding="max_length",
|
|
|
87 |
max_length=512
|
88 |
)["input_ids"]
|
89 |
|
90 |
+
output_ids_sum = self.model.generate(
|
91 |
+
input_ids=input_ids_sum,
|
92 |
max_length=130,
|
93 |
no_repeat_ngram_size=2,
|
94 |
num_beams=4
|
95 |
)[0]
|
96 |
|
97 |
+
summary = self.tokenizer.decode(
|
98 |
+
output_ids_sum,
|
99 |
skip_special_tokens=True,
|
100 |
clean_up_tokenization_spaces=False
|
101 |
)
|
|
|
167 |
#### Prueba
|
168 |
WHITESPACE_HANDLER = lambda k: re.sub('\s+', ' ', re.sub('\n+', ' ', k.strip()))
|
169 |
|
170 |
+
input_ids_sum = self.tokenizer(
|
171 |
[WHITESPACE_HANDLER(results["text"])],
|
172 |
return_tensors="pt",
|
173 |
padding="max_length",
|
|
|
175 |
max_length=512
|
176 |
)["input_ids"]
|
177 |
|
178 |
+
output_ids_sum = self.model.generate(
|
179 |
+
input_ids=input_ids_sum,
|
180 |
max_length=130,
|
181 |
no_repeat_ngram_size=2,
|
182 |
num_beams=4
|
183 |
)[0]
|
184 |
|
185 |
+
summary = self.tokenizer.decode(
|
186 |
+
output_ids_sum,
|
187 |
skip_special_tokens=True,
|
188 |
clean_up_tokenization_spaces=False
|
189 |
)
|