File size: 736 Bytes
08ae6c5
 
1ffc326
9346f1c
4596a70
2a5f9fb
08ae6c5
8c49cb6
08ae6c5
2a73469
08ae6c5
 
1ffc326
08ae6c5
d084b26
1ffc326
08ae6c5
8c49cb6
08ae6c5
01233b7
08ae6c5
 
 
10f9b3c
08ae6c5
10f9b3c
daf60ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
import logging
import subprocess
import gradio as gr
from apscheduler.schedulers.background import BackgroundScheduler

logging.basicConfig(level=logging.ERROR)

from src.logging import LOGGER, read_logs

sys.stdout = LOGGER
sys.stderr = LOGGER

subprocess.run(["python", "scripts/fix_harness_import.py"])

def launch_backend():
    _ = subprocess.run(["python", "main_backend_lighteval.py"])

demo = gr.Blocks()
with demo:
    logs = gr.Code(interactive=False)
    demo.load(read_logs, None, logs, every=1)
    
scheduler = BackgroundScheduler()
scheduler.add_job(launch_backend, "interval", seconds=60) # will only allow one job to be run at the same time
scheduler.start()
demo.queue(default_concurrency_limit=40).launch()