Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,18 @@ Saves title + description of every novel to CSV and JSONL.
|
|
| 5 |
Fully resumable β safe to restart if interrupted.
|
| 6 |
"""
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
import os
|
| 9 |
import csv
|
| 10 |
import json
|
|
@@ -522,11 +534,9 @@ with gr.Blocks(title="Novel Scraper") as demo:
|
|
| 522 |
btn_refresh.click(ui_status, outputs=status_box)
|
| 523 |
btn_refresh.click(ui_files, outputs=file_out)
|
| 524 |
|
| 525 |
-
# Gradio
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
timer_status.tick(ui_status, outputs=status_box)
|
| 529 |
-
timer_files.tick(ui_files, outputs=file_out)
|
| 530 |
|
| 531 |
if __name__ == "__main__":
|
| 532 |
demo.launch()
|
|
|
|
| 5 |
Fully resumable β safe to restart if interrupted.
|
| 6 |
"""
|
| 7 |
|
| 8 |
+
# ββ audioop stub ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 9 |
+
# Python 3.13 removed the `audioop` stdlib module.
|
| 10 |
+
# Gradio 4.x pulls in pydub which tries to import it β and crashes.
|
| 11 |
+
# We don't use any audio features, so a no-op stub fixes the crash entirely.
|
| 12 |
+
import sys as _sys
|
| 13 |
+
import types as _types
|
| 14 |
+
if "audioop" not in _sys.modules:
|
| 15 |
+
_audioop_stub = _types.ModuleType("audioop")
|
| 16 |
+
_sys.modules["audioop"] = _audioop_stub
|
| 17 |
+
_sys.modules["pyaudioop"] = _audioop_stub # pydub tries this name too
|
| 18 |
+
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 19 |
+
|
| 20 |
import os
|
| 21 |
import csv
|
| 22 |
import json
|
|
|
|
| 534 |
btn_refresh.click(ui_status, outputs=status_box)
|
| 535 |
btn_refresh.click(ui_files, outputs=file_out)
|
| 536 |
|
| 537 |
+
# Gradio 4.x auto-poll β fires every N seconds while the tab is open
|
| 538 |
+
demo.load(ui_status, outputs=status_box, every=5)
|
| 539 |
+
demo.load(ui_files, outputs=file_out, every=10)
|
|
|
|
|
|
|
| 540 |
|
| 541 |
if __name__ == "__main__":
|
| 542 |
demo.launch()
|