Spaces:
Running
on
T4
Running
on
T4
| #!/usr/bin/env python3 | |
| """KAIdol A/B Test Arena - Simple Version""" | |
| import gradio as gr | |
| def chat_response(message, character): | |
| """Mock μλ΅ μμ±""" | |
| thinking = f"<think>{character}μ μ μ₯μμ μκ°ν΄λ³΄λ©΄... μ΄ λ©μμ§μ μ΄λ»κ² λ°μν΄μΌ ν κΉ?</think>" | |
| response = f"μλ ~ λ°κ°μ! λλ {character}μΌ~" | |
| return f"{thinking}\n\n{response}" | |
| # μΊλ¦ν° λͺ©λ‘ | |
| CHARACTERS = ["κ°μ¨", "μμ΄μ", "μ΄μ§ν", "μ°¨λν", "μ΅λ―Ό"] | |
| # λͺ¨λΈ λͺ©λ‘ | |
| MODELS = [ | |
| "hyperclovax-32b-dpo-v5", | |
| "qwen2.5-14b-dpo-v5", | |
| "qwen2.5-7b-dpo-v5", | |
| "exaone-7.8b-dpo-v5", | |
| ] | |
| with gr.Blocks(title="KAIdol A/B Test Arena") as demo: | |
| gr.Markdown("# KAIdol A/B Test Arena") | |
| gr.Markdown("K-pop μμ΄λ λ‘€νλ μ΄ λͺ¨λΈ A/B λΉκ΅ νκ°") | |
| gr.Markdown("**Mock λͺ¨λ**: μ€μ λͺ¨λΈ μμ΄ ν μ€νΈ μλ΅μ μμ±ν©λλ€.") | |
| with gr.Row(): | |
| character = gr.Dropdown(choices=CHARACTERS, value="κ°μ¨", label="μΊλ¦ν°") | |
| model_a = gr.Dropdown(choices=MODELS, value=MODELS[0], label="Model A") | |
| model_b = gr.Dropdown(choices=MODELS, value=MODELS[1], label="Model B") | |
| with gr.Row(): | |
| with gr.Column(): | |
| gr.Markdown("### Model A") | |
| response_a = gr.Textbox(label="μλ΅", lines=5) | |
| with gr.Column(): | |
| gr.Markdown("### Model B") | |
| response_b = gr.Textbox(label="μλ΅", lines=5) | |
| user_input = gr.Textbox(label="λ©μμ§", placeholder="μμ΄λμκ² λ©μμ§λ₯Ό 보λ΄μΈμ...") | |
| submit_btn = gr.Button("μ μ‘", variant="primary") | |
| def generate(msg, char, ma, mb): | |
| return chat_response(msg, char), chat_response(msg, char) | |
| submit_btn.click( | |
| fn=generate, | |
| inputs=[user_input, character, model_a, model_b], | |
| outputs=[response_a, response_b] | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch(server_name="0.0.0.0", server_port=7860) | |