Spaces:
Sleeping
Sleeping
unknown commited on
Commit ·
8204fb2
1
Parent(s): 3cb8345
Debug HF import path
Browse files
app.py
CHANGED
|
@@ -1,26 +1,36 @@
|
|
| 1 |
import json
|
| 2 |
import tempfile
|
| 3 |
import html
|
|
|
|
| 4 |
import sys
|
| 5 |
from pathlib import Path
|
| 6 |
-
import gradio as gr
|
| 7 |
-
|
| 8 |
|
| 9 |
ROOT_DIR = Path(__file__).resolve().parent
|
| 10 |
SRC_DIR = ROOT_DIR / "src"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
try:
|
| 17 |
from paper2lab.inference.pipeline import PaperPipeline
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
PaperPipeline = None
|
| 20 |
|
| 21 |
try:
|
| 22 |
from paper2lab.rag.qa import answer_from_pipeline_result
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
answer_from_pipeline_result = None
|
| 25 |
|
| 26 |
|
|
|
|
| 1 |
import json
|
| 2 |
import tempfile
|
| 3 |
import html
|
| 4 |
+
import os
|
| 5 |
import sys
|
| 6 |
from pathlib import Path
|
|
|
|
|
|
|
| 7 |
|
| 8 |
ROOT_DIR = Path(__file__).resolve().parent
|
| 9 |
SRC_DIR = ROOT_DIR / "src"
|
| 10 |
|
| 11 |
+
sys.path.insert(0, str(ROOT_DIR))
|
| 12 |
+
sys.path.insert(0, str(SRC_DIR))
|
| 13 |
|
| 14 |
+
print("DEBUG ROOT_DIR:", ROOT_DIR)
|
| 15 |
+
print("DEBUG SRC_DIR:", SRC_DIR)
|
| 16 |
+
print("DEBUG SRC_EXISTS:", SRC_DIR.exists())
|
| 17 |
+
print("DEBUG PIPELINE_EXISTS:", (SRC_DIR / "paper2lab" / "inference" / "pipeline.py").exists())
|
| 18 |
+
print("DEBUG sys.path[:5]:", sys.path[:5])
|
| 19 |
+
|
| 20 |
+
import gradio as gr
|
| 21 |
|
| 22 |
try:
|
| 23 |
from paper2lab.inference.pipeline import PaperPipeline
|
| 24 |
+
print("DEBUG PaperPipeline import: OK")
|
| 25 |
+
except Exception as e:
|
| 26 |
+
print("DEBUG PaperPipeline import failed:", repr(e))
|
| 27 |
PaperPipeline = None
|
| 28 |
|
| 29 |
try:
|
| 30 |
from paper2lab.rag.qa import answer_from_pipeline_result
|
| 31 |
+
print("DEBUG RAG import: OK")
|
| 32 |
+
except Exception as e:
|
| 33 |
+
print("DEBUG RAG import failed:", repr(e))
|
| 34 |
answer_from_pipeline_result = None
|
| 35 |
|
| 36 |
|