Spaces:
Sleeping
Sleeping
add data
Browse files
main3.py
DELETED
|
@@ -1,75 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/python3
|
| 2 |
-
# -*- coding: utf-8 -*-
|
| 3 |
-
"""
|
| 4 |
-
docker build -t llm_eval_system:v20250724_1442 .
|
| 5 |
-
|
| 6 |
-
docker stop llm_eval_system_7862 && docker rm llm_eval_system_7862
|
| 7 |
-
|
| 8 |
-
docker run -itd \
|
| 9 |
-
--name llm_eval_system_7862 \
|
| 10 |
-
--restart=always \
|
| 11 |
-
--network host \
|
| 12 |
-
-e port=7862 \
|
| 13 |
-
llm_eval_system:v20250724_1442 \
|
| 14 |
-
/bin/bash
|
| 15 |
-
"""
|
| 16 |
-
import argparse
|
| 17 |
-
import logging
|
| 18 |
-
import platform
|
| 19 |
-
|
| 20 |
-
import gradio as gr
|
| 21 |
-
|
| 22 |
-
from project_settings import environment, project_path, log_directory
|
| 23 |
-
from toolbox.os.command import Command
|
| 24 |
-
import log
|
| 25 |
-
|
| 26 |
-
log.setup_size_rotating(log_directory=log_directory)
|
| 27 |
-
|
| 28 |
-
logger = logging.getLogger("main")
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
def get_args():
|
| 32 |
-
parser = argparse.ArgumentParser()
|
| 33 |
-
parser.add_argument(
|
| 34 |
-
"--eval_data_dir",
|
| 35 |
-
default=(project_path / "data/eval_data").as_posix(),
|
| 36 |
-
type=str,
|
| 37 |
-
)
|
| 38 |
-
args = parser.parse_args()
|
| 39 |
-
return args
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
def shell(cmd: str):
|
| 43 |
-
return Command.popen(cmd)
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
def main():
|
| 47 |
-
args = get_args()
|
| 48 |
-
|
| 49 |
-
# ui
|
| 50 |
-
with gr.Blocks() as blocks:
|
| 51 |
-
with gr.Tabs():
|
| 52 |
-
with gr.TabItem("shell"):
|
| 53 |
-
shell_text = gr.Textbox(label="cmd")
|
| 54 |
-
shell_button = gr.Button("run")
|
| 55 |
-
shell_output = gr.Textbox(label="output", max_lines=100)
|
| 56 |
-
|
| 57 |
-
shell_button.click(
|
| 58 |
-
shell,
|
| 59 |
-
inputs=[shell_text, ],
|
| 60 |
-
outputs=[shell_output],
|
| 61 |
-
)
|
| 62 |
-
|
| 63 |
-
# http://127.0.0.1:7861/
|
| 64 |
-
# http://10.75.27.247:7861/
|
| 65 |
-
blocks.queue().launch(
|
| 66 |
-
share=False if platform.system() == "Windows" else False,
|
| 67 |
-
server_name="127.0.0.1" if platform.system() == "Windows" else "0.0.0.0",
|
| 68 |
-
# server_name="0.0.0.0",
|
| 69 |
-
server_port=environment.get("port", 7860, dtype=int),
|
| 70 |
-
)
|
| 71 |
-
return
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
if __name__ == "__main__":
|
| 75 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|