Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,10 @@ def extract_text(image):
|
|
| 16 |
# Define a function to explain the extracted text
|
| 17 |
def explain_text(text):
|
| 18 |
tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
# Convert the text to a string if necessary
|
| 21 |
if not isinstance(text, str):
|
| 22 |
text = str(text)
|
|
|
|
| 16 |
# Define a function to explain the extracted text
|
| 17 |
def explain_text(text):
|
| 18 |
tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
| 19 |
+
|
| 20 |
+
# Set pad_token to eos_token (end of sequence token)
|
| 21 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 22 |
+
|
| 23 |
# Convert the text to a string if necessary
|
| 24 |
if not isinstance(text, str):
|
| 25 |
text = str(text)
|