Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -243,6 +243,10 @@ import gradio as gr
|
|
243 |
|
244 |
# user_response, stage_history, conversation_history, pre_conversation_history = "", "", """""", """"""
|
245 |
|
|
|
|
|
|
|
|
|
246 |
with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
|
247 |
|
248 |
with gr.Row():
|
@@ -256,10 +260,11 @@ with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
|
|
256 |
</div>""")
|
257 |
|
258 |
chatbot = gr.Chatbot()
|
259 |
-
msg = gr.Textbox()
|
260 |
-
stage_history = gr.Textbox(
|
261 |
submit_btn = gr.Button("전송")
|
262 |
-
clear_btn = gr.ClearButton([msg, chatbot])
|
|
|
263 |
|
264 |
def answer(user_response, chat_history, stage_history):
|
265 |
chat_history = chat_history or []
|
@@ -271,7 +276,7 @@ with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
|
|
271 |
conversation_history = pre_conversation_history + f"User: {user_response} <END_OF_TURN>\n"
|
272 |
stage_number = stage_analyzer_chain.run({'conversation_history': conversation_history, 'stage_history': stage_history})
|
273 |
stage_number = stage_number[-1]
|
274 |
-
stage_history += stage_number if stage_history == "" else ", " + stage_number
|
275 |
response = agent_executor.run({'input':user_response, 'conversation_history': pre_conversation_history, 'stage_number': stage_number})
|
276 |
# conversation_history += "이우선: " + response + "\n"
|
277 |
response = response.split('<END_OF_TURN>')[0]
|
|
|
243 |
|
244 |
# user_response, stage_history, conversation_history, pre_conversation_history = "", "", """""", """"""
|
245 |
|
246 |
+
stage_description = ""
|
247 |
+
for key, value in conversation_stages_dict.items():
|
248 |
+
stage_description += f"{key}.{value}\n"
|
249 |
+
|
250 |
with gr.Blocks(css='#chatbot .overflow-y-auto{height:750px}') as demo:
|
251 |
|
252 |
with gr.Row():
|
|
|
260 |
</div>""")
|
261 |
|
262 |
chatbot = gr.Chatbot()
|
263 |
+
msg = gr.Textbox(label='User input')
|
264 |
+
stage_history = gr.Textbox(value="stage history: ", interactive=False, label='stage history')
|
265 |
submit_btn = gr.Button("전송")
|
266 |
+
clear_btn = gr.ClearButton([msg, chatbot, stage_history])
|
267 |
+
stage_info = gr.Textbox(value=stage_description, interactive=False, label='stage description')
|
268 |
|
269 |
def answer(user_response, chat_history, stage_history):
|
270 |
chat_history = chat_history or []
|
|
|
276 |
conversation_history = pre_conversation_history + f"User: {user_response} <END_OF_TURN>\n"
|
277 |
stage_number = stage_analyzer_chain.run({'conversation_history': conversation_history, 'stage_history': stage_history})
|
278 |
stage_number = stage_number[-1]
|
279 |
+
stage_history += stage_number if stage_history == "stage history: " else ", " + stage_number
|
280 |
response = agent_executor.run({'input':user_response, 'conversation_history': pre_conversation_history, 'stage_number': stage_number})
|
281 |
# conversation_history += "이우선: " + response + "\n"
|
282 |
response = response.split('<END_OF_TURN>')[0]
|