Spaces:
Running
Running
import gradio as gr | |
from case_loader import get_case_names, load_case, run_case | |
def build_ui(): | |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="purple")) as demo: | |
# ์๋จ ์๊ฐ | |
gr.Markdown(""" | |
# ๐พ PersonaChatEngine HF-Serve | |
**๊ฒ์ ๋ด NPC ๋ฉ์ธ ๋ชจ๋ธ ์ถ๋ก ์๋ฒ** | |
Qwen 3B ๊ธฐ๋ฐ LoRA ํ์ธํ๋ ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ NPC ๋์ฌ๋ฅผ ์์ฑํฉ๋๋ค. | |
""") | |
with gr.Row(): | |
gr.Button("๐ ์์ธ ๋ฌธ์ ๋ณด๊ธฐ", | |
link="https://huggingface.co/spaces/m97j/PersonaChatEngine_HF-serve/blob/main/README.md") | |
gr.Button("๐ป Colab ํ ์คํธ ์ด๊ธฐ", | |
link="https://colab.research.google.com/drive/1_-qH8kdoU2Jj58TdaSnswHex-BFefInq?usp=sharing#scrollTo=cFJGv8BJ8oPD") | |
gr.Markdown("### ๐ฏ ํ ์คํธ ์ผ์ด์ค ๊ธฐ๋ฐ ๊ฐ๋จ ์คํ") | |
with gr.Row(): | |
case_dropdown = gr.Dropdown(choices=get_case_names(), label="ํ ์คํธ ์ผ์ด์ค ์ ํ", value=get_case_names()[0]) | |
load_btn = gr.Button("์ผ์ด์ค ๋ถ๋ฌ์ค๊ธฐ") | |
case_info = gr.Textbox(label="์ผ์ด์ค ์ ๋ณด", lines=10) | |
player_input = gr.Textbox(label="Player Utterance ์์ ", lines=2) | |
run_btn = gr.Button("๐ Run Inference", variant="primary") | |
npc_resp = gr.Textbox(label="NPC Response") | |
deltas = gr.JSON(label="Deltas") | |
flags = gr.JSON(label="Flags Probabilities") | |
load_btn.click( | |
fn=lambda name: load_case(get_case_names().index(name)), | |
inputs=[case_dropdown], | |
outputs=[case_info, player_input] | |
) | |
run_btn.click( | |
fn=lambda name, utt: run_case(get_case_names().index(name), utt), | |
inputs=[case_dropdown, player_input], | |
outputs=[npc_resp, deltas, flags] | |
) | |
gr.Markdown(""" | |
--- | |
โ ๏ธ **์ค์ ๊ฒ์ ํ์ดํ๋ผ์ธ ํ ์คํธ**๋ [ai-server Swagger](https://huggingface.co/spaces/m97j/PersonaChatEngine_ai_server)์์ ์งํํ์ธ์. | |
""") | |
return demo | |