Spaces:
Sleeping
Sleeping
downgraded to gradio 5
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ def make_system_message(system_message, demographics, occupation, psychographics
|
|
| 22 |
|
| 23 |
def stream_chat(
|
| 24 |
message,
|
| 25 |
-
history,
|
| 26 |
system_message,
|
| 27 |
demographics,
|
| 28 |
occupation,
|
|
@@ -34,14 +34,14 @@ def stream_chat(
|
|
| 34 |
top_p,
|
| 35 |
):
|
| 36 |
"""
|
| 37 |
-
Streaming generator that yields the progressively updated chat history
|
| 38 |
"""
|
| 39 |
# 1) Build system + conversation messages
|
| 40 |
sys_msg = make_system_message(system_message, demographics, occupation, psychographics, buying_habits, critical_mode)
|
| 41 |
|
| 42 |
messages = [{"role": "system", "content": sys_msg}]
|
| 43 |
|
| 44 |
-
# Append past history
|
| 45 |
for msg in (history or []):
|
| 46 |
messages.append({"role": msg["role"], "content": msg["content"]})
|
| 47 |
|
|
@@ -88,8 +88,8 @@ with gr.Blocks(title="Virtual Consumer Persona – Live Focus Group!") as demo:
|
|
| 88 |
*Powered by OpenAI GPT-4o-mini. Developed by wn.*
|
| 89 |
""")
|
| 90 |
|
| 91 |
-
#
|
| 92 |
-
chatbot = gr.Chatbot(height=450
|
| 93 |
|
| 94 |
with gr.Column():
|
| 95 |
instructions = gr.Textbox(
|
|
|
|
| 22 |
|
| 23 |
def stream_chat(
|
| 24 |
message,
|
| 25 |
+
history,
|
| 26 |
system_message,
|
| 27 |
demographics,
|
| 28 |
occupation,
|
|
|
|
| 34 |
top_p,
|
| 35 |
):
|
| 36 |
"""
|
| 37 |
+
Streaming generator that yields the progressively updated chat history.
|
| 38 |
"""
|
| 39 |
# 1) Build system + conversation messages
|
| 40 |
sys_msg = make_system_message(system_message, demographics, occupation, psychographics, buying_habits, critical_mode)
|
| 41 |
|
| 42 |
messages = [{"role": "system", "content": sys_msg}]
|
| 43 |
|
| 44 |
+
# Append past history
|
| 45 |
for msg in (history or []):
|
| 46 |
messages.append({"role": msg["role"], "content": msg["content"]})
|
| 47 |
|
|
|
|
| 88 |
*Powered by OpenAI GPT-4o-mini. Developed by wn.*
|
| 89 |
""")
|
| 90 |
|
| 91 |
+
# Removed the type="messages" argument to prevent the initialization crash
|
| 92 |
+
chatbot = gr.Chatbot(height=450)
|
| 93 |
|
| 94 |
with gr.Column():
|
| 95 |
instructions = gr.Textbox(
|