Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,10 +71,15 @@ def process_pdf_to_epub(pdf_file, title, author):
|
|
| 71 |
num_return_sequences=1,
|
| 72 |
do_sample=True,
|
| 73 |
)
|
| 74 |
-
|
| 75 |
prompt_length = inputs["input_ids"].shape[1]
|
| 76 |
new_tokens = output[:, prompt_length:]
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
except Exception as e:
|
| 80 |
decoded = f"[Error processing page {page_num}: {str(e)}]"
|
|
|
|
| 71 |
num_return_sequences=1,
|
| 72 |
do_sample=True,
|
| 73 |
)
|
|
|
|
| 74 |
prompt_length = inputs["input_ids"].shape[1]
|
| 75 |
new_tokens = output[:, prompt_length:]
|
| 76 |
+
|
| 77 |
+
try:
|
| 78 |
+
decoded_list = processor.tokenizer.batch_decode(new_tokens, skip_special_tokens=True)
|
| 79 |
+
decoded = decoded_list[0].strip() if decoded_list else "[No output generated]"
|
| 80 |
+
except Exception as decode_error:
|
| 81 |
+
decoded = f"[Decoding error on page {page_num}: {str(decode_error)}]"
|
| 82 |
+
|
| 83 |
|
| 84 |
except Exception as e:
|
| 85 |
decoded = f"[Error processing page {page_num}: {str(e)}]"
|