Spaces:
Sleeping
Sleeping
add metadata
Browse files- app.py +1 -1
- data_access.py +4 -2
app.py
CHANGED
@@ -209,7 +209,7 @@ async def main():
|
|
209 |
with gr.Row():
|
210 |
with gr.Column(scale=3):
|
211 |
results_table = gr.DataFrame(
|
212 |
-
headers=['id', 'tractate', 'folio', 'in_baseline', 'baseline_rank', 'in_source_run', 'source_run_rank', 'source_reason'],
|
213 |
interactive=False
|
214 |
)
|
215 |
with gr.Column(scale=1):
|
|
|
209 |
with gr.Row():
|
210 |
with gr.Column(scale=3):
|
211 |
results_table = gr.DataFrame(
|
212 |
+
headers=['id', 'tractate', 'folio', 'in_baseline', 'baseline_rank', 'in_source_run', 'source_run_rank', 'source_reason', 'metadata'],
|
213 |
interactive=False
|
214 |
)
|
215 |
with gr.Column(scale=1):
|
data_access.py
CHANGED
@@ -194,7 +194,8 @@ async def get_unified_sources(question_id: int, source_finder_id: int, run_id: i
|
|
194 |
async with get_async_connection() as conn:
|
195 |
# Get sources from source_runs
|
196 |
query_runs = """
|
197 |
-
SELECT tb.tractate_chunk_id as id, sr.rank as source_rank, sr.tractate, sr.folio,
|
|
|
198 |
FROM source_runs sr join talmud_bavli tb on sr.sugya_id = tb.xml_id
|
199 |
WHERE sr.question_id = $1 AND sr.source_finder_id = $2 AND sr.run_id = $3
|
200 |
"""
|
@@ -234,7 +235,8 @@ async def get_unified_sources(question_id: int, source_finder_id: int, run_id: i
|
|
234 |
"baseline_rank": baseline_dict.get(sugya_id, {}).get("baseline_rank", "N/A"),
|
235 |
"in_source_run": "Yes" if in_source_run else "No",
|
236 |
"source_run_rank": source_runs_dict.get(sugya_id, {}).get("source_rank", "N/A"),
|
237 |
-
"source_reason": source_runs_dict.get(sugya_id, {}).get("reason", "N/A")
|
|
|
238 |
}
|
239 |
unified_results.append(result)
|
240 |
|
|
|
194 |
async with get_async_connection() as conn:
|
195 |
# Get sources from source_runs
|
196 |
query_runs = """
|
197 |
+
SELECT tb.tractate_chunk_id as id, sr.rank as source_rank, sr.tractate, sr.folio,
|
198 |
+
sr.reason as source_reason, sr.metadata
|
199 |
FROM source_runs sr join talmud_bavli tb on sr.sugya_id = tb.xml_id
|
200 |
WHERE sr.question_id = $1 AND sr.source_finder_id = $2 AND sr.run_id = $3
|
201 |
"""
|
|
|
235 |
"baseline_rank": baseline_dict.get(sugya_id, {}).get("baseline_rank", "N/A"),
|
236 |
"in_source_run": "Yes" if in_source_run else "No",
|
237 |
"source_run_rank": source_runs_dict.get(sugya_id, {}).get("source_rank", "N/A"),
|
238 |
+
"source_reason": source_runs_dict.get(sugya_id, {}).get("reason", "N/A"),
|
239 |
+
"metadata": source_runs_dict.get(sugya_id, {}).get("metadata", "")
|
240 |
}
|
241 |
unified_results.append(result)
|
242 |
|