Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,8 @@ import uuid
|
|
| 12 |
from dotenv import load_dotenv
|
| 13 |
from huggingface_hub import HfApi, HfFolder
|
| 14 |
import datetime
|
|
|
|
|
|
|
| 15 |
|
| 16 |
write_token = os.getenv("write_token")
|
| 17 |
|
|
@@ -1052,8 +1054,8 @@ with gr.Blocks(css=css) as app:
|
|
| 1052 |
|
| 1053 |
# 4) After User Profile, go to Chatbot
|
| 1054 |
def show_chatbot_after_profile(age, profession, interest, app_state=None):
|
| 1055 |
-
|
| 1056 |
-
|
| 1057 |
|
| 1058 |
# Ensure app_state exists
|
| 1059 |
if app_state is None:
|
|
@@ -1065,17 +1067,17 @@ def show_chatbot_after_profile(age, profession, interest, app_state=None):
|
|
| 1065 |
app_state["standardized_data"]['Interests'] = interest.strip()
|
| 1066 |
|
| 1067 |
# Debugging: Check that profile data is stored correctly
|
|
|
|
| 1068 |
print("Profile stored in standardized_data:", app_state["standardized_data"])
|
| 1069 |
|
| 1070 |
return gr.update(visible=False), gr.update(visible=True), "Profile submitted successfully. Proceeding to the chatbot."
|
| 1071 |
|
| 1072 |
-
|
| 1073 |
-
|
| 1074 |
user_profile_button.click(
|
| 1075 |
fn=show_chatbot_after_profile,
|
| 1076 |
inputs=[age_input, profession_input, interest_input, gr.State(app_state)],
|
| 1077 |
outputs=[page_3b, page_3, user_profile_output]
|
| 1078 |
)
|
|
|
|
| 1079 |
# 5) After chatbot is done, go to Usability (button initially hidden)
|
| 1080 |
def go_to_usability():
|
| 1081 |
return gr.update(visible=False), gr.update(visible=True)
|
|
|
|
| 12 |
from dotenv import load_dotenv
|
| 13 |
from huggingface_hub import HfApi, HfFolder
|
| 14 |
import datetime
|
| 15 |
+
import logging
|
| 16 |
+
logging.basicConfig(level=logging.DEBUG)
|
| 17 |
|
| 18 |
write_token = os.getenv("write_token")
|
| 19 |
|
|
|
|
| 1054 |
|
| 1055 |
# 4) After User Profile, go to Chatbot
|
| 1056 |
def show_chatbot_after_profile(age, profession, interest, app_state=None):
|
| 1057 |
+
logging.debug("Submit button clicked.")
|
| 1058 |
+
logging.debug(f"Inputs received - Age: {age}, Profession: {profession}, Interest: {interest}")
|
| 1059 |
|
| 1060 |
# Ensure app_state exists
|
| 1061 |
if app_state is None:
|
|
|
|
| 1067 |
app_state["standardized_data"]['Interests'] = interest.strip()
|
| 1068 |
|
| 1069 |
# Debugging: Check that profile data is stored correctly
|
| 1070 |
+
logging.debug(f"Updated app_state: {app_state}")
|
| 1071 |
print("Profile stored in standardized_data:", app_state["standardized_data"])
|
| 1072 |
|
| 1073 |
return gr.update(visible=False), gr.update(visible=True), "Profile submitted successfully. Proceeding to the chatbot."
|
| 1074 |
|
|
|
|
|
|
|
| 1075 |
user_profile_button.click(
|
| 1076 |
fn=show_chatbot_after_profile,
|
| 1077 |
inputs=[age_input, profession_input, interest_input, gr.State(app_state)],
|
| 1078 |
outputs=[page_3b, page_3, user_profile_output]
|
| 1079 |
)
|
| 1080 |
+
|
| 1081 |
# 5) After chatbot is done, go to Usability (button initially hidden)
|
| 1082 |
def go_to_usability():
|
| 1083 |
return gr.update(visible=False), gr.update(visible=True)
|