Spaces:
Running
Running
Pclanglais
commited on
Commit
•
cc8b44c
1
Parent(s):
dd838d3
Update app.py
Browse files
app.py
CHANGED
@@ -172,12 +172,8 @@ def ocr_correction(prompt, max_new_tokens=500):
|
|
172 |
prompt = f"""### Text ###\n{prompt}\n\n\n### Correction ###\n"""
|
173 |
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(device)
|
174 |
|
175 |
-
# Set the number of threads for PyTorch
|
176 |
-
torch.set_num_threads(num_threads)
|
177 |
-
|
178 |
# Generate text
|
179 |
-
output = model.generate,
|
180 |
-
input_ids,
|
181 |
max_new_tokens=max_new_tokens,
|
182 |
pad_token_id=tokenizer.eos_token_id,
|
183 |
top_k=50,
|
|
|
172 |
prompt = f"""### Text ###\n{prompt}\n\n\n### Correction ###\n"""
|
173 |
input_ids = tokenizer.encode(prompt, return_tensors="pt").to(device)
|
174 |
|
|
|
|
|
|
|
175 |
# Generate text
|
176 |
+
output = model.generate(input_ids,
|
|
|
177 |
max_new_tokens=max_new_tokens,
|
178 |
pad_token_id=tokenizer.eos_token_id,
|
179 |
top_k=50,
|