Spaces:
Running
Running
arbarikcp commited on
Commit ·
ca6d779
1
Parent(s): 0ea48ea
update app.py
Browse files- app/app.py +10 -2
app/app.py
CHANGED
|
@@ -17,11 +17,19 @@ entirely by ``configs/index_config.json``. Running
|
|
| 17 |
code changes.
|
| 18 |
"""
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
import gradio as gr
|
| 21 |
import pandas as pd
|
| 22 |
|
| 23 |
-
from
|
| 24 |
-
from .scoring import fmt_score, score_result
|
| 25 |
from src import index_registry
|
| 26 |
from src.data.ragbench_loader import load_ragbench_config
|
| 27 |
from src.pipeline.rag_pipeline import PipelineConfig, build_pipeline
|
|
|
|
| 17 |
code changes.
|
| 18 |
"""
|
| 19 |
|
| 20 |
+
import os
|
| 21 |
+
import sys
|
| 22 |
+
|
| 23 |
+
# When run as a script by HF Spaces, the app/ directory is on sys.path, which
|
| 24 |
+
# makes 'app' resolve to app.py itself instead of the app/ package. Inserting
|
| 25 |
+
# the project root first ensures 'from app import cache' finds the package.
|
| 26 |
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 27 |
+
|
| 28 |
import gradio as gr
|
| 29 |
import pandas as pd
|
| 30 |
|
| 31 |
+
from app import cache
|
| 32 |
+
from app.scoring import fmt_score, score_result
|
| 33 |
from src import index_registry
|
| 34 |
from src.data.ragbench_loader import load_ragbench_config
|
| 35 |
from src.pipeline.rag_pipeline import PipelineConfig, build_pipeline
|