Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
derek-thomas
commited on
Commit
·
f59a2e9
1
Parent(s):
d38510d
Restructuring and adding download button
Browse files
app.py
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
|
|
| 1 |
from src.logging import configure_root_logger
|
|
|
|
|
|
|
|
|
|
| 2 |
configure_root_logger()
|
| 3 |
|
| 4 |
from functools import partial
|
| 5 |
-
import logging
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
from main_backend_lighteval import run_auto_eval
|
| 9 |
from src.display.log_visualizer import log_file_to_html_string
|
| 10 |
from src.display.css_html_js import dark_mode_gradio_js
|
| 11 |
from src.envs import REFRESH_RATE, REPO_ID, QUEUE_REPO, RESULTS_REPO
|
| 12 |
-
from src.logging import setup_logger
|
| 13 |
|
| 14 |
logging.basicConfig(level=logging.INFO)
|
| 15 |
logger = setup_logger(__name__)
|
|
@@ -17,17 +20,16 @@ logger = setup_logger(__name__)
|
|
| 17 |
|
| 18 |
intro_md = f"""
|
| 19 |
# Intro
|
| 20 |
-
This is
|
|
|
|
| 21 |
|
|
|
|
| 22 |
# Important links
|
| 23 |
| Description | Link |
|
| 24 |
|-----------------|------|
|
| 25 |
| Leaderboard | [{REPO_ID}](https://huggingface.co/spaces/{REPO_ID}) |
|
| 26 |
| Queue Repo | [{QUEUE_REPO}](https://huggingface.co/datasets/{QUEUE_REPO}) |
|
| 27 |
| Results Repo | [{RESULTS_REPO}](https://huggingface.co/datasets/{RESULTS_REPO}) |
|
| 28 |
-
|
| 29 |
-
# Logs
|
| 30 |
-
Note that the lines of the log visual are reversed.
|
| 31 |
"""
|
| 32 |
|
| 33 |
def button_auto_eval():
|
|
@@ -38,19 +40,21 @@ def button_auto_eval():
|
|
| 38 |
reverse_order_checkbox = gr.Checkbox(label="Reverse Order", value=True)
|
| 39 |
|
| 40 |
with gr.Blocks(js=dark_mode_gradio_js) as demo:
|
|
|
|
| 41 |
with gr.Tab("Application"):
|
| 42 |
-
gr.Markdown(intro_md)
|
| 43 |
output_html = gr.HTML(partial(log_file_to_html_string, reverse=reverse_order_checkbox), every=1)
|
| 44 |
-
with gr.
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
dummy = gr.Markdown(run_auto_eval, every=REFRESH_RATE, visible=False)
|
| 48 |
|
| 49 |
-
# Add a button that when pressed, triggers run_auto_eval
|
| 50 |
-
button = gr.Button("Manually Run Evaluation")
|
| 51 |
button.click(fn=button_auto_eval, inputs=[], outputs=[])
|
| 52 |
|
| 53 |
|
| 54 |
-
|
| 55 |
if __name__ == '__main__':
|
| 56 |
demo.queue(default_concurrency_limit=40).launch(server_name="0.0.0.0", show_error=True, server_port=7860)
|
|
|
|
| 1 |
+
import logging
|
| 2 |
from src.logging import configure_root_logger
|
| 3 |
+
logging.getLogger("httpx").setLevel(logging.WARNING)
|
| 4 |
+
logging.getLogger("numexpr").setLevel(logging.WARNING)
|
| 5 |
+
logging.getLogger("absl").setLevel(logging.WARNING)
|
| 6 |
configure_root_logger()
|
| 7 |
|
| 8 |
from functools import partial
|
|
|
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
from main_backend_lighteval import run_auto_eval
|
| 12 |
from src.display.log_visualizer import log_file_to_html_string
|
| 13 |
from src.display.css_html_js import dark_mode_gradio_js
|
| 14 |
from src.envs import REFRESH_RATE, REPO_ID, QUEUE_REPO, RESULTS_REPO
|
| 15 |
+
from src.logging import setup_logger, log_file
|
| 16 |
|
| 17 |
logging.basicConfig(level=logging.INFO)
|
| 18 |
logger = setup_logger(__name__)
|
|
|
|
| 20 |
|
| 21 |
intro_md = f"""
|
| 22 |
# Intro
|
| 23 |
+
This is a visual for the auto evaluator.
|
| 24 |
+
"""
|
| 25 |
|
| 26 |
+
links_md = f"""
|
| 27 |
# Important links
|
| 28 |
| Description | Link |
|
| 29 |
|-----------------|------|
|
| 30 |
| Leaderboard | [{REPO_ID}](https://huggingface.co/spaces/{REPO_ID}) |
|
| 31 |
| Queue Repo | [{QUEUE_REPO}](https://huggingface.co/datasets/{QUEUE_REPO}) |
|
| 32 |
| Results Repo | [{RESULTS_REPO}](https://huggingface.co/datasets/{RESULTS_REPO}) |
|
|
|
|
|
|
|
|
|
|
| 33 |
"""
|
| 34 |
|
| 35 |
def button_auto_eval():
|
|
|
|
| 40 |
reverse_order_checkbox = gr.Checkbox(label="Reverse Order", value=True)
|
| 41 |
|
| 42 |
with gr.Blocks(js=dark_mode_gradio_js) as demo:
|
| 43 |
+
gr.Markdown(intro_md)
|
| 44 |
with gr.Tab("Application"):
|
|
|
|
| 45 |
output_html = gr.HTML(partial(log_file_to_html_string, reverse=reverse_order_checkbox), every=1)
|
| 46 |
+
with gr.Row():
|
| 47 |
+
download_button = gr.DownloadButton("Download Log File", value=log_file)
|
| 48 |
+
with gr.Accordion('Log View Configuration', open=False):
|
| 49 |
+
reverse_order_checkbox.render()
|
| 50 |
+
# Add a button that when pressed, triggers run_auto_eval
|
| 51 |
+
button = gr.Button("Manually Run Evaluation")
|
| 52 |
+
gr.Markdown(links_md)
|
| 53 |
|
| 54 |
dummy = gr.Markdown(run_auto_eval, every=REFRESH_RATE, visible=False)
|
| 55 |
|
|
|
|
|
|
|
| 56 |
button.click(fn=button_auto_eval, inputs=[], outputs=[])
|
| 57 |
|
| 58 |
|
|
|
|
| 59 |
if __name__ == '__main__':
|
| 60 |
demo.queue(default_concurrency_limit=40).launch(server_name="0.0.0.0", show_error=True, server_port=7860)
|