Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- __pycache__/app.cpython-313.pyc +0 -0
- app.py +20 -16
- mu_net_trained.pt +3 -0
__pycache__/app.cpython-313.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ
|
|
|
app.py
CHANGED
|
@@ -574,25 +574,29 @@ with gr.Blocks() as demo:
|
|
| 574 |
with gr.Tab("🏋️ Train"):
|
| 575 |
gr.Markdown("Train the μ-Net live on this hardware.")
|
| 576 |
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
with gr.Row():
|
| 586 |
-
lr = gr.Number(value=0.001, label="Learning Rate")
|
| 587 |
-
lambda_c = gr.Number(value=0.01, label="λ (coherence regularization)")
|
| 588 |
|
| 589 |
train_btn = gr.Button("🚀 Train μ-Net", variant="primary")
|
| 590 |
|
| 591 |
-
train_log = gr.
|
| 592 |
-
train_curve = gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 593 |
|
| 594 |
train_btn.click(
|
| 595 |
-
|
| 596 |
inputs=[task, epochs, lr, lambda_c],
|
| 597 |
outputs=[train_log, train_curve]
|
| 598 |
)
|
|
@@ -605,7 +609,7 @@ with gr.Blocks() as demo:
|
|
| 605 |
label="8 ratio values (comma-separated)"
|
| 606 |
)
|
| 607 |
infer_btn = gr.Button("Predict", variant="primary")
|
| 608 |
-
infer_output = gr.
|
| 609 |
infer_btn.click(run_inference, inputs=input_box, outputs=infer_output)
|
| 610 |
|
| 611 |
with gr.Tab("📤 Push to Hub"):
|
|
@@ -616,7 +620,7 @@ with gr.Blocks() as demo:
|
|
| 616 |
label="Repository ID"
|
| 617 |
)
|
| 618 |
push_btn = gr.Button("Push Model", variant="primary")
|
| 619 |
-
push_output = gr.
|
| 620 |
push_btn.click(push_to_hub, inputs=repo_input, outputs=push_output)
|
| 621 |
|
| 622 |
with gr.Tab("🧠 Architecture"):
|
|
|
|
| 574 |
with gr.Tab("🏋️ Train"):
|
| 575 |
gr.Markdown("Train the μ-Net live on this hardware.")
|
| 576 |
|
| 577 |
+
task = gr.Radio(
|
| 578 |
+
["Coherence Prediction", "Sequence Prediction"],
|
| 579 |
+
value="Coherence Prediction",
|
| 580 |
+
label="Task"
|
| 581 |
+
)
|
| 582 |
+
epochs = gr.Slider(50, 500, value=100, step=10, label="Epochs")
|
| 583 |
+
lr = gr.Number(value=0.001, label="Learning Rate")
|
| 584 |
+
lambda_c = gr.Number(value=0.01, label="λ coherence")
|
|
|
|
|
|
|
|
|
|
| 585 |
|
| 586 |
train_btn = gr.Button("🚀 Train μ-Net", variant="primary")
|
| 587 |
|
| 588 |
+
train_log = gr.Textbox(label="Training Log", lines=20, interactive=False)
|
| 589 |
+
train_curve = gr.Textbox(label="Training Curve", lines=15, interactive=False)
|
| 590 |
+
|
| 591 |
+
def safe_train(task, epochs, lr, lam):
|
| 592 |
+
try:
|
| 593 |
+
return train_model(task, epochs, lr, lam)
|
| 594 |
+
except Exception as e:
|
| 595 |
+
import traceback
|
| 596 |
+
return f"ERROR: {e}\n\n{traceback.format_exc()}", ""
|
| 597 |
|
| 598 |
train_btn.click(
|
| 599 |
+
safe_train,
|
| 600 |
inputs=[task, epochs, lr, lambda_c],
|
| 601 |
outputs=[train_log, train_curve]
|
| 602 |
)
|
|
|
|
| 609 |
label="8 ratio values (comma-separated)"
|
| 610 |
)
|
| 611 |
infer_btn = gr.Button("Predict", variant="primary")
|
| 612 |
+
infer_output = gr.Textbox(label="Result", lines=15, interactive=False)
|
| 613 |
infer_btn.click(run_inference, inputs=input_box, outputs=infer_output)
|
| 614 |
|
| 615 |
with gr.Tab("📤 Push to Hub"):
|
|
|
|
| 620 |
label="Repository ID"
|
| 621 |
)
|
| 622 |
push_btn = gr.Button("Push Model", variant="primary")
|
| 623 |
+
push_output = gr.Textbox(label="Status", lines=3, interactive=False)
|
| 624 |
push_btn.click(push_to_hub, inputs=repo_input, outputs=push_output)
|
| 625 |
|
| 626 |
with gr.Tab("🧠 Architecture"):
|
mu_net_trained.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b9a1e606de65304e8e2f90cd9d1fc3baeee139b88cdb4c7dad80c84002124c84
|
| 3 |
+
size 157633
|