Mdrnfox commited on
Commit
c3483b0
·
verified ·
1 Parent(s): 48a61de

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import spaces
3
+ import subprocess
4
+ import requests
5
+ import datetime
6
+
7
+ @spaces.GPU
8
+ def run_peft_eval():
9
+ subprocess.run(["python3", "run_eval.py"], check=True)
10
+ print("Evaluation complete.")
11
+ try:
12
+ requests.post(os.environ["HF_ENDPOINT_SHUTDOWN"]) # Shutdown space after run
13
+ except Exception as e:
14
+ print("Failed to shutdown:", e)
15
+ return f"PEFT-Bench completed at {datetime.datetime.utcnow():%Y-%m-%d %H:%M UTC}"
16
+
17
+ with gr.Blocks() as demo:
18
+ gr.Markdown("### Running PEFT-Bench Evaluation...\nThis Space will shut down when done.")
19
+ output = gr.Textbox(label="Status")
20
+ demo.load(fn=run_peft_eval, outputs=output)
21
+
22
+ demo.launch()