Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse files- Gradio_UI.py +3 -8
Gradio_UI.py
CHANGED
|
@@ -68,7 +68,7 @@ def step_by_step_agent(user_input, state):
|
|
| 68 |
if step < len(QUESTIONS):
|
| 69 |
next_question = QUESTIONS[step][1]
|
| 70 |
state["step"] += 1
|
| 71 |
-
return next_question, state
|
| 72 |
|
| 73 |
filled_template = f"""
|
| 74 |
# AI Act Compliance Register
|
|
@@ -124,18 +124,13 @@ def launch_step_by_step_ui():
|
|
| 124 |
restart_button = gr.Button("🔁 Restart")
|
| 125 |
|
| 126 |
def chat_logic(user_msg, state):
|
| 127 |
-
reply, updated_state = step_by_step_agent(user_msg, state)
|
| 128 |
messages = [gr.ChatMessage(role="user", content=user_msg)]
|
| 129 |
|
| 130 |
if isinstance(reply, str):
|
| 131 |
messages.append(gr.ChatMessage(role="assistant", content=reply))
|
| 132 |
|
| 133 |
-
|
| 134 |
-
if isinstance(updated_state, dict) and updated_state.get("done"):
|
| 135 |
-
file_path = updated_state["pdf"]
|
| 136 |
-
return messages, updated_state, file_path
|
| 137 |
-
|
| 138 |
-
return messages, updated_state, None
|
| 139 |
|
| 140 |
def restart_conversation():
|
| 141 |
return [initial_message], {"step": 0, "answers": {}}, None
|
|
|
|
| 68 |
if step < len(QUESTIONS):
|
| 69 |
next_question = QUESTIONS[step][1]
|
| 70 |
state["step"] += 1
|
| 71 |
+
return next_question, state, None
|
| 72 |
|
| 73 |
filled_template = f"""
|
| 74 |
# AI Act Compliance Register
|
|
|
|
| 124 |
restart_button = gr.Button("🔁 Restart")
|
| 125 |
|
| 126 |
def chat_logic(user_msg, state):
|
| 127 |
+
reply, updated_state, file_path = step_by_step_agent(user_msg, state)
|
| 128 |
messages = [gr.ChatMessage(role="user", content=user_msg)]
|
| 129 |
|
| 130 |
if isinstance(reply, str):
|
| 131 |
messages.append(gr.ChatMessage(role="assistant", content=reply))
|
| 132 |
|
| 133 |
+
return messages, updated_state, file_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
def restart_conversation():
|
| 136 |
return [initial_message], {"step": 0, "answers": {}}, None
|