Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -468,8 +468,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
468 |
gr.Markdown("## βπΎ Wilson Handwritten OCR β with Feedback Loop, Memory & GRPO Export")
|
469 |
|
470 |
model_choice = gr.Radio(choices=list(MODEL_PATHS.keys()),
|
471 |
-
|
472 |
-
|
473 |
|
474 |
with gr.Tab("πΌ Image Inference"):
|
475 |
query_input = gr.Textbox(label="Custom Prompt (optional)", placeholder="Leave empty for RAW structured output")
|
@@ -497,7 +497,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
497 |
btn_good = gr.Button("π Accept (Save Feedback as Correct)", variant="primary")
|
498 |
btn_bad = gr.Button("π Bad (Save Feedback as Incorrect)")
|
499 |
|
500 |
-
feedback_status = gr.Markdown()
|
501 |
|
502 |
pdf_btn = gr.Button("β¬οΈ Download as PDF")
|
503 |
word_btn = gr.Button("β¬οΈ Download as Word")
|
@@ -563,10 +563,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
563 |
3) Keep **Enable Memory Post-correction** checked on inference/eval tabs.
|
564 |
""")
|
565 |
build_mem_btn = gr.Button("π§ Build/Refresh Memory from Feedback")
|
566 |
-
mem_status = gr.Markdown()
|
567 |
build_mem_btn.click(fn=compile_memory_rules, outputs=[mem_status])
|
568 |
|
569 |
-
csv_status = gr.Markdown()
|
570 |
|
571 |
gr.Markdown("---")
|
572 |
gr.Markdown("### β¬οΈ Download Feedback Data")
|
@@ -575,25 +575,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
575 |
download_csv_file = gr.File(label="CSV File")
|
576 |
download_csv_btn.click(fn=get_csv_file, outputs=download_csv_file)
|
577 |
|
578 |
-
# ... code for previous tabs ...
|
579 |
-
|
580 |
-
with gr.Tab("βοΈ Feedback & Memory"):
|
581 |
-
gr.Markdown(...)
|
582 |
-
build_mem_btn = gr.Button("π§ Build/Refresh Memory from Feedback")
|
583 |
-
mem_status = gr.Markdown()
|
584 |
-
build_mem_btn.click(fn=compile_memory_rules, outputs=[mem_status])
|
585 |
-
|
586 |
-
csv_status = gr.Markdown()
|
587 |
-
|
588 |
-
gr.Markdown("---")
|
589 |
-
gr.Markdown("### β¬οΈ Download Feedback Data")
|
590 |
-
with gr.Row():
|
591 |
-
download_csv_btn = gr.Button("β¬οΈ Download Feedback as CSV")
|
592 |
-
download_csv_file = gr.File(label="CSV File")
|
593 |
-
download_csv_btn.click(fn=get_csv_file, outputs=download_csv_file)
|
594 |
-
|
595 |
-
# Make sure this line is indented correctly, aligning with the other `with gr.Tab` blocks.
|
596 |
-
# It should have the same indentation as the "π Model Evaluation" and "βοΈ Feedback & Memory" tabs.
|
597 |
with gr.Tab("π§ͺ GRPO / Dataset"):
|
598 |
gr.Markdown("""
|
599 |
**GRPO Fine-tuning** (run offline or in a training Space):
|
@@ -607,13 +588,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
607 |
Set BASE_MODEL/OUTPUT_DIR env vars if you like.
|
608 |
```""")
|
609 |
|
610 |
-
# All of these components must also be indented correctly under this `with` block.
|
611 |
grpo_btn = gr.Button("π¦ Export GRPO Preferences")
|
612 |
-
grpo_status = gr.Markdown()
|
613 |
grpo_btn.click(fn=export_grpo_preferences, outputs=[grpo_status])
|
614 |
|
615 |
write_script_btn = gr.Button("π Write grpo_train.py")
|
616 |
-
write_script_status = gr.Markdown()
|
617 |
write_script_btn.click(fn=lambda: f"β
Trainer script written to {_write_trainer_script()}", outputs=[write_script_status])
|
618 |
|
619 |
gr.Markdown("---")
|
|
|
468 |
gr.Markdown("## βπΎ Wilson Handwritten OCR β with Feedback Loop, Memory & GRPO Export")
|
469 |
|
470 |
model_choice = gr.Radio(choices=list(MODEL_PATHS.keys()),
|
471 |
+
value=list(MODEL_PATHS.keys())[0],
|
472 |
+
label="Select OCR Model")
|
473 |
|
474 |
with gr.Tab("πΌ Image Inference"):
|
475 |
query_input = gr.Textbox(label="Custom Prompt (optional)", placeholder="Leave empty for RAW structured output")
|
|
|
497 |
btn_good = gr.Button("π Accept (Save Feedback as Correct)", variant="primary")
|
498 |
btn_bad = gr.Button("π Bad (Save Feedback as Incorrect)")
|
499 |
|
500 |
+
feedback_status = gr.Markdown("")
|
501 |
|
502 |
pdf_btn = gr.Button("β¬οΈ Download as PDF")
|
503 |
word_btn = gr.Button("β¬οΈ Download as Word")
|
|
|
563 |
3) Keep **Enable Memory Post-correction** checked on inference/eval tabs.
|
564 |
""")
|
565 |
build_mem_btn = gr.Button("π§ Build/Refresh Memory from Feedback")
|
566 |
+
mem_status = gr.Markdown("")
|
567 |
build_mem_btn.click(fn=compile_memory_rules, outputs=[mem_status])
|
568 |
|
569 |
+
csv_status = gr.Markdown("")
|
570 |
|
571 |
gr.Markdown("---")
|
572 |
gr.Markdown("### β¬οΈ Download Feedback Data")
|
|
|
575 |
download_csv_file = gr.File(label="CSV File")
|
576 |
download_csv_btn.click(fn=get_csv_file, outputs=download_csv_file)
|
577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
with gr.Tab("π§ͺ GRPO / Dataset"):
|
579 |
gr.Markdown("""
|
580 |
**GRPO Fine-tuning** (run offline or in a training Space):
|
|
|
588 |
Set BASE_MODEL/OUTPUT_DIR env vars if you like.
|
589 |
```""")
|
590 |
|
|
|
591 |
grpo_btn = gr.Button("π¦ Export GRPO Preferences")
|
592 |
+
grpo_status = gr.Markdown("")
|
593 |
grpo_btn.click(fn=export_grpo_preferences, outputs=[grpo_status])
|
594 |
|
595 |
write_script_btn = gr.Button("π Write grpo_train.py")
|
596 |
+
write_script_status = gr.Markdown("")
|
597 |
write_script_btn.click(fn=lambda: f"β
Trainer script written to {_write_trainer_script()}", outputs=[write_script_status])
|
598 |
|
599 |
gr.Markdown("---")
|