Spaces:
Sleeping
Sleeping
Pointf5ive commited on
Commit Β·
d149161
1
Parent(s): 1d3ee6e
fix: separate manuscript extraction from scoring; run-button only scoring
Browse files
app.py
CHANGED
|
@@ -2807,10 +2807,10 @@ def analyze_manuscript_and_refresh(
|
|
| 2807 |
|
| 2808 |
def analyze_manuscript_for_dashboard(file_obj, active_path: str):
|
| 2809 |
"""
|
| 2810 |
-
|
| 2811 |
- accepts a manuscript upload directly on Dashboard
|
| 2812 |
-
- runs Codex extraction
|
| 2813 |
-
-
|
| 2814 |
"""
|
| 2815 |
file_path = _extract_uploaded_path(file_obj)
|
| 2816 |
if not file_path:
|
|
@@ -2820,16 +2820,17 @@ def analyze_manuscript_for_dashboard(file_obj, active_path: str):
|
|
| 2820 |
author_name = stem.replace("_", " ")[:120]
|
| 2821 |
works_sampled = stem.replace("_", " ")[:180]
|
| 2822 |
author_id = "CA-XXX"
|
| 2823 |
-
report, json_out, status
|
| 2824 |
file_obj=file_obj,
|
| 2825 |
author_name=author_name,
|
| 2826 |
author_id=author_id,
|
| 2827 |
works_sampled=works_sampled,
|
| 2828 |
-
active_path=active_path,
|
| 2829 |
)
|
| 2830 |
-
|
| 2831 |
-
|
| 2832 |
-
|
|
|
|
|
|
|
| 2833 |
|
| 2834 |
|
| 2835 |
def recalc_log(log_df, active_path: str):
|
|
@@ -2880,6 +2881,14 @@ with gr.Blocks(title="TOTEM Studio") as demo:
|
|
| 2880 |
# ββ TAB 1: DASHBOARD βββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 2881 |
with gr.TabItem("Dashboard"):
|
| 2882 |
dashboard = gr.HTML(value=initial_dashboard_html())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2883 |
|
| 2884 |
with gr.Row(elem_id="studio-actions"):
|
| 2885 |
with gr.Column(elem_classes=["wrap"]):
|
|
@@ -2918,7 +2927,7 @@ with gr.Blocks(title="TOTEM Studio") as demo:
|
|
| 2918 |
type="filepath",
|
| 2919 |
)
|
| 2920 |
dashboard_manuscript_analyze = gr.Button(
|
| 2921 |
-
"Analyze Manuscript
|
| 2922 |
variant="primary",
|
| 2923 |
)
|
| 2924 |
dashboard_manuscript_status = gr.Textbox(
|
|
@@ -3108,9 +3117,6 @@ with gr.Blocks(title="TOTEM Studio") as demo:
|
|
| 3108 |
dashboard_manuscript_report,
|
| 3109 |
dashboard_manuscript_json,
|
| 3110 |
dashboard_manuscript_status,
|
| 3111 |
-
dashboard,
|
| 3112 |
-
log_state,
|
| 3113 |
-
score_status,
|
| 3114 |
],
|
| 3115 |
)
|
| 3116 |
recalc_button.click(recalc_log, inputs=[log_state, active_path],
|
|
|
|
| 2807 |
|
| 2808 |
def analyze_manuscript_for_dashboard(file_obj, active_path: str):
|
| 2809 |
"""
|
| 2810 |
+
Dashboard manuscript pipeline (Draft Mode / ORDER_91):
|
| 2811 |
- accepts a manuscript upload directly on Dashboard
|
| 2812 |
+
- runs Codex extraction only
|
| 2813 |
+
- does NOT trigger scoring refresh (TOTEM scoring is run-button only)
|
| 2814 |
"""
|
| 2815 |
file_path = _extract_uploaded_path(file_obj)
|
| 2816 |
if not file_path:
|
|
|
|
| 2820 |
author_name = stem.replace("_", " ")[:120]
|
| 2821 |
works_sampled = stem.replace("_", " ")[:180]
|
| 2822 |
author_id = "CA-XXX"
|
| 2823 |
+
report, json_out, status = run_codex_extraction(
|
| 2824 |
file_obj=file_obj,
|
| 2825 |
author_name=author_name,
|
| 2826 |
author_id=author_id,
|
| 2827 |
works_sampled=works_sampled,
|
|
|
|
| 2828 |
)
|
| 2829 |
+
dashboard_status = (
|
| 2830 |
+
f"{status} | Draft Mode active: extraction complete. "
|
| 2831 |
+
"No auto-scoring was run. Click 'Run TOTEM Analysis' to score."
|
| 2832 |
+
)
|
| 2833 |
+
return report, json_out, dashboard_status
|
| 2834 |
|
| 2835 |
|
| 2836 |
def recalc_log(log_df, active_path: str):
|
|
|
|
| 2881 |
# ββ TAB 1: DASHBOARD βββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 2882 |
with gr.TabItem("Dashboard"):
|
| 2883 |
dashboard = gr.HTML(value=initial_dashboard_html())
|
| 2884 |
+
gr.HTML(
|
| 2885 |
+
"<div style='max-width:1180px;margin:10px auto 12px auto;padding:10px 14px;"
|
| 2886 |
+
"border:1px solid rgba(242,193,78,.35);border-radius:10px;"
|
| 2887 |
+
"background:rgba(10,22,45,.85);color:#f6f1e8;font-size:13px;'>"
|
| 2888 |
+
"<b>Mode:</b> Draft Mode (ORDER_91) keeps manuscript extraction separate from scoring. "
|
| 2889 |
+
"Only <b>Run TOTEM Analysis</b> updates the 5 scoring metrics."
|
| 2890 |
+
"</div>"
|
| 2891 |
+
)
|
| 2892 |
|
| 2893 |
with gr.Row(elem_id="studio-actions"):
|
| 2894 |
with gr.Column(elem_classes=["wrap"]):
|
|
|
|
| 2927 |
type="filepath",
|
| 2928 |
)
|
| 2929 |
dashboard_manuscript_analyze = gr.Button(
|
| 2930 |
+
"Analyze Manuscript (No Auto-Score)",
|
| 2931 |
variant="primary",
|
| 2932 |
)
|
| 2933 |
dashboard_manuscript_status = gr.Textbox(
|
|
|
|
| 3117 |
dashboard_manuscript_report,
|
| 3118 |
dashboard_manuscript_json,
|
| 3119 |
dashboard_manuscript_status,
|
|
|
|
|
|
|
|
|
|
| 3120 |
],
|
| 3121 |
)
|
| 3122 |
recalc_button.click(recalc_log, inputs=[log_state, active_path],
|