Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import sys
|
3 |
import random
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
# Add src to path
|
7 |
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
|
@@ -62,19 +63,6 @@ question_examples = [
|
|
62 |
["A 30-year-old patient is on Prozac for depression and now diagnosed with WHIM syndrome. Is Xolremdi suitable?"]
|
63 |
]
|
64 |
|
65 |
-
# Initialize agent
|
66 |
-
agent = TxAgent(
|
67 |
-
model_name,
|
68 |
-
rag_model_name,
|
69 |
-
tool_files_dict=new_tool_files,
|
70 |
-
force_finish=True,
|
71 |
-
enable_checker=True,
|
72 |
-
step_rag_num=10,
|
73 |
-
seed=100,
|
74 |
-
additional_default_tools=["DirectResponse", "RequireClarification"]
|
75 |
-
)
|
76 |
-
agent.init_model()
|
77 |
-
|
78 |
# === Create Gradio UI ===
|
79 |
def create_ui():
|
80 |
with gr.Blocks(css=css) as demo:
|
@@ -127,9 +115,8 @@ def create_ui():
|
|
127 |
|
128 |
chatbot.retry(
|
129 |
handle_retry,
|
130 |
-
chatbot, chatbot,
|
131 |
-
|
132 |
-
multi_agent, conversation_state, max_round
|
133 |
)
|
134 |
|
135 |
# === Chat Interface setup
|
@@ -152,8 +139,7 @@ def create_ui():
|
|
152 |
return demo
|
153 |
|
154 |
if __name__ == "__main__":
|
155 |
-
# Initialize multiprocessing
|
156 |
-
freeze_support()
|
157 |
|
158 |
# Initialize agent
|
159 |
agent = TxAgent(
|
|
|
2 |
import sys
|
3 |
import random
|
4 |
import gradio as gr
|
5 |
+
from multiprocessing import freeze_support # Added for multiprocessing support
|
6 |
|
7 |
# Add src to path
|
8 |
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
|
|
|
63 |
["A 30-year-old patient is on Prozac for depression and now diagnosed with WHIM syndrome. Is Xolremdi suitable?"]
|
64 |
]
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
# === Create Gradio UI ===
|
67 |
def create_ui():
|
68 |
with gr.Blocks(css=css) as demo:
|
|
|
115 |
|
116 |
chatbot.retry(
|
117 |
handle_retry,
|
118 |
+
inputs=[chatbot, chatbot, temperature, max_new_tokens, max_tokens, multi_agent, conversation_state, max_round],
|
119 |
+
outputs=chatbot
|
|
|
120 |
)
|
121 |
|
122 |
# === Chat Interface setup
|
|
|
139 |
return demo
|
140 |
|
141 |
if __name__ == "__main__":
|
142 |
+
freeze_support() # Initialize multiprocessing support
|
|
|
143 |
|
144 |
# Initialize agent
|
145 |
agent = TxAgent(
|