创建Gradio界面
()
| 400 | return f"❌ Error processing question: {str(e)}", "" |
| 401 | |
| 402 | def create_visualization_interface(): |
| 403 | """创建Gradio界面""" |
| 404 | |
| 405 | # 创建模型管理器实例 |
| 406 | model_manager = ModelManager() |
| 407 | |
| 408 | # 获取本机IP |
| 409 | local_ip = get_local_ip() |
| 410 | |
| 411 | # 自定义CSS样式 |
| 412 | custom_css = """ |
| 413 | @import url('https://fonts.googleapis.com/css2?family=Times+New+Roman&display=swap'); |
| 414 | |
| 415 | * { |
| 416 | font-family: 'SimHei', 'Times New Roman', serif !important; |
| 417 | } |
| 418 | |
| 419 | .gradio-container { |
| 420 | font-family: 'SimHei', 'Times New Roman', serif !important; |
| 421 | } |
| 422 | |
| 423 | .gr-textbox input, .gr-textbox textarea { |
| 424 | font-family: 'SimHei', 'Times New Roman', serif !important; |
| 425 | font-size: 14px !important; |
| 426 | } |
| 427 | |
| 428 | .gr-button { |
| 429 | font-family: 'SimHei', Arial, sans-serif !important; |
| 430 | font-weight: bold !important; |
| 431 | } |
| 432 | |
| 433 | h1, h2, h3, h4, h5, h6 { |
| 434 | font-family: 'SimHei', Arial, sans-serif !important; |
| 435 | } |
| 436 | |
| 437 | .markdown { |
| 438 | font-family: 'SimHei', 'Times New Roman', serif !important; |
| 439 | } |
| 440 | """ |
| 441 | |
| 442 | # 创建Gradio界面 |
| 443 | with gr.Blocks(title="R3-RAG Visualization", theme=gr.themes.Soft(), css=custom_css) as demo: |
| 444 | # 论文标题和介绍 |
| 445 | paper_title = "R3-RAG: Learning Step-by-Step Reasoning and Retrieval for LLMs via Reinforcement Learning" |
| 446 | authors = "Yuan Li, Qi Luo, Xiaonan Li, Bufan Li, Qinyuan Cheng, Bo Wang, Yining Zheng, Yuxin Wang, Zhangyue Yin, Xipeng Qiu" |
| 447 | affiliation = "School of Computer Science, Fudan University" |
| 448 | github_url = "https://github.com/Yuan-Li-FNLP/R3-RAG" |
| 449 | |
| 450 | gr.Markdown(f""" |
| 451 | # {paper_title} |
| 452 | |
| 453 | **Authors:** {authors} |
| 454 | **Affiliation:** {affiliation} |
| 455 | **GitHub:** [{github_url}]({github_url}) |
| 456 | **Server Address:** `{local_ip}:7860` |
| 457 | |
| 458 | --- |
| 459 |
no test coverage detected