File size: 685 Bytes
c3483b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import spaces
import subprocess
import requests
import datetime

@spaces.GPU  
def run_peft_eval():
    subprocess.run(["python3", "run_eval.py"], check=True)
    print("Evaluation complete.")
    try:
        requests.post(os.environ["HF_ENDPOINT_SHUTDOWN"])  # Shutdown space after run
    except Exception as e:
        print("Failed to shutdown:", e)
    return f"PEFT-Bench completed at {datetime.datetime.utcnow():%Y-%m-%d %H:%M UTC}"

with gr.Blocks() as demo:
    gr.Markdown("### Running PEFT-Bench Evaluation...\nThis Space will shut down when done.")
    output = gr.Textbox(label="Status")
    demo.load(fn=run_peft_eval, outputs=output)

demo.launch()