Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,30 +7,29 @@ import os
|
|
7 |
|
8 |
@spaces.GPU
|
9 |
def run_peft_eval():
|
10 |
-
print("Starting evaluation
|
11 |
try:
|
12 |
result = subprocess.run(["python3", "run_eval.py"], capture_output=True, text=True, check=True)
|
13 |
print(result.stdout, flush=True)
|
14 |
except subprocess.CalledProcessError as e:
|
15 |
-
print("
|
16 |
-
|
17 |
-
return "Evaluation failed. Check logs."
|
18 |
|
19 |
try:
|
20 |
shutdown_url = os.environ.get("HF_ENDPOINT_SHUTDOWN")
|
21 |
if shutdown_url:
|
22 |
-
print("
|
23 |
requests.post(shutdown_url)
|
24 |
except Exception as e:
|
25 |
-
print("
|
26 |
|
27 |
-
return f"PEFT-Bench completed at {datetime.datetime.utcnow():%Y-%m-%d %H:%M UTC}"
|
28 |
|
29 |
with gr.Blocks() as demo:
|
30 |
-
gr.Markdown("##
|
31 |
-
gr.Markdown("
|
32 |
status = gr.Textbox(label="Status", lines=2)
|
33 |
-
btn = gr.Button("Start Evaluation
|
34 |
-
btn.click(run_peft_eval, outputs=status)
|
35 |
|
36 |
demo.launch()
|
|
|
7 |
|
8 |
@spaces.GPU
|
9 |
def run_peft_eval():
|
10 |
+
print("Starting evaluation...", flush=True)
|
11 |
try:
|
12 |
result = subprocess.run(["python3", "run_eval.py"], capture_output=True, text=True, check=True)
|
13 |
print(result.stdout, flush=True)
|
14 |
except subprocess.CalledProcessError as e:
|
15 |
+
print("❌ Eval script failed:\n", e.stderr, flush=True)
|
16 |
+
return "❌ Evaluation failed. Check logs."
|
|
|
17 |
|
18 |
try:
|
19 |
shutdown_url = os.environ.get("HF_ENDPOINT_SHUTDOWN")
|
20 |
if shutdown_url:
|
21 |
+
print("Triggering shutdown...", flush=True)
|
22 |
requests.post(shutdown_url)
|
23 |
except Exception as e:
|
24 |
+
print("Shutdown failed:", e, flush=True)
|
25 |
|
26 |
+
return f"✅ PEFT-Bench completed at {datetime.datetime.utcnow():%Y-%m-%d %H:%M UTC}"
|
27 |
|
28 |
with gr.Blocks() as demo:
|
29 |
+
gr.Markdown("##PEFT-Bench GPU Evaluator")
|
30 |
+
gr.Markdown("Click the button below to start evaluation. The Space will shut down when done.")
|
31 |
status = gr.Textbox(label="Status", lines=2)
|
32 |
+
btn = gr.Button("Start Evaluation")
|
33 |
+
btn.click(fn=run_peft_eval, outputs=status)
|
34 |
|
35 |
demo.launch()
|