Switch to Gradio 5.6.0 with messages format
Browse files- Use Gradio 5.6.0 which is compatible with newer huggingface_hub
- Use messages format for Chatbot (dict with role/content)
- Remove audioop-lts since Gradio 5.x doesn't need it
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- README.md +1 -1
- app.py +22 -7
- requirements.txt +1 -2
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🌱
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: yellow
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.6.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
app.py
CHANGED
|
@@ -881,7 +881,8 @@ def create_app():
|
|
| 881 |
height=500,
|
| 882 |
show_label=True,
|
| 883 |
elem_id="chatbot",
|
| 884 |
-
bubble_full_width=False
|
|
|
|
| 885 |
)
|
| 886 |
|
| 887 |
# Needs selector (hidden until stage 5)
|
|
@@ -1003,7 +1004,10 @@ def create_app():
|
|
| 1003 |
|
| 1004 |
if stage == 5 and not sel_needs:
|
| 1005 |
bot_response = "Please take a moment to select your needs from the list above, then click 'Confirm My Needs' to continue."
|
| 1006 |
-
history = history + [
|
|
|
|
|
|
|
|
|
|
| 1007 |
return (
|
| 1008 |
history, "", stage, session, sel_needs,
|
| 1009 |
f"{stage}/13: {STAGE_NAMES[stage]}",
|
|
@@ -1020,7 +1024,10 @@ def create_app():
|
|
| 1020 |
)
|
| 1021 |
|
| 1022 |
if error:
|
| 1023 |
-
history = history + [
|
|
|
|
|
|
|
|
|
|
| 1024 |
return (
|
| 1025 |
history, "", stage, session, sel_needs,
|
| 1026 |
f"{stage}/13: {STAGE_NAMES[stage]}",
|
|
@@ -1029,9 +1036,14 @@ def create_app():
|
|
| 1029 |
)
|
| 1030 |
|
| 1031 |
if message != "continue":
|
| 1032 |
-
history = history + [
|
|
|
|
|
|
|
|
|
|
| 1033 |
else:
|
| 1034 |
-
history = history + [
|
|
|
|
|
|
|
| 1035 |
|
| 1036 |
show_needs = (next_stage == 5)
|
| 1037 |
|
|
@@ -1077,7 +1089,7 @@ def create_app():
|
|
| 1077 |
if not all_selected:
|
| 1078 |
return (
|
| 1079 |
all_selected,
|
| 1080 |
-
history + [
|
| 1081 |
stage,
|
| 1082 |
session
|
| 1083 |
)
|
|
@@ -1091,7 +1103,10 @@ def create_app():
|
|
| 1091 |
True
|
| 1092 |
)
|
| 1093 |
|
| 1094 |
-
history = history + [
|
|
|
|
|
|
|
|
|
|
| 1095 |
|
| 1096 |
return all_selected, history, next_stage, updated_session
|
| 1097 |
|
|
|
|
| 881 |
height=500,
|
| 882 |
show_label=True,
|
| 883 |
elem_id="chatbot",
|
| 884 |
+
bubble_full_width=False,
|
| 885 |
+
type="messages"
|
| 886 |
)
|
| 887 |
|
| 888 |
# Needs selector (hidden until stage 5)
|
|
|
|
| 1004 |
|
| 1005 |
if stage == 5 and not sel_needs:
|
| 1006 |
bot_response = "Please take a moment to select your needs from the list above, then click 'Confirm My Needs' to continue."
|
| 1007 |
+
history = history + [
|
| 1008 |
+
{"role": "user", "content": message},
|
| 1009 |
+
{"role": "assistant", "content": bot_response}
|
| 1010 |
+
]
|
| 1011 |
return (
|
| 1012 |
history, "", stage, session, sel_needs,
|
| 1013 |
f"{stage}/13: {STAGE_NAMES[stage]}",
|
|
|
|
| 1024 |
)
|
| 1025 |
|
| 1026 |
if error:
|
| 1027 |
+
history = history + [
|
| 1028 |
+
{"role": "user", "content": message},
|
| 1029 |
+
{"role": "assistant", "content": error}
|
| 1030 |
+
]
|
| 1031 |
return (
|
| 1032 |
history, "", stage, session, sel_needs,
|
| 1033 |
f"{stage}/13: {STAGE_NAMES[stage]}",
|
|
|
|
| 1036 |
)
|
| 1037 |
|
| 1038 |
if message != "continue":
|
| 1039 |
+
history = history + [
|
| 1040 |
+
{"role": "user", "content": message},
|
| 1041 |
+
{"role": "assistant", "content": response}
|
| 1042 |
+
]
|
| 1043 |
else:
|
| 1044 |
+
history = history + [
|
| 1045 |
+
{"role": "assistant", "content": response}
|
| 1046 |
+
]
|
| 1047 |
|
| 1048 |
show_needs = (next_stage == 5)
|
| 1049 |
|
|
|
|
| 1089 |
if not all_selected:
|
| 1090 |
return (
|
| 1091 |
all_selected,
|
| 1092 |
+
history + [{"role": "assistant", "content": "Please select at least one need before continuing."}],
|
| 1093 |
stage,
|
| 1094 |
session
|
| 1095 |
)
|
|
|
|
| 1103 |
True
|
| 1104 |
)
|
| 1105 |
|
| 1106 |
+
history = history + [
|
| 1107 |
+
{"role": "user", "content": f"Selected needs: {', '.join(all_selected)}"},
|
| 1108 |
+
{"role": "assistant", "content": response}
|
| 1109 |
+
]
|
| 1110 |
|
| 1111 |
return all_selected, history, next_stage, updated_session
|
| 1112 |
|
requirements.txt
CHANGED
|
@@ -1,3 +1,2 @@
|
|
| 1 |
-
|
| 2 |
-
gradio==4.44.0
|
| 3 |
anthropic>=0.18.0
|
|
|
|
| 1 |
+
gradio==5.6.0
|
|
|
|
| 2 |
anthropic>=0.18.0
|