Spaces:
Sleeping
Sleeping
returned to plain checkboxes not interactive!
Browse files
app.py
CHANGED
|
@@ -99,9 +99,8 @@ def respond(message, history):
|
|
| 99 |
str_top_weather = "\n".join(top_weather)
|
| 100 |
str_top_luggage = "\n".join(top_luggage)
|
| 101 |
|
| 102 |
-
messages = [{"role": "system", "content": f"You're a friendly and gen z chatbot. Base your response on the provided context: {top_weather} and {top_luggage}.
|
| 103 |
-
|
| 104 |
-
"{\"message\": \"some helpful reply\", \"list\": [\"item1\", \"item2\"]}"}]
|
| 105 |
if history:
|
| 106 |
messages.extend(history)
|
| 107 |
|
|
@@ -114,27 +113,7 @@ def respond(message, history):
|
|
| 114 |
)
|
| 115 |
|
| 116 |
return response['choices'][0]['message']['content'].strip()
|
| 117 |
-
try:
|
| 118 |
-
checklist = json.loads(text)
|
| 119 |
-
if isinstance(checklist,list):
|
| 120 |
-
return checklist
|
| 121 |
-
except:
|
| 122 |
-
pass
|
| 123 |
-
|
| 124 |
-
return["error"]
|
| 125 |
-
|
| 126 |
-
#chatbot = gr.ChatInterface(respond, type = 'messages')
|
| 127 |
-
with gr.Blocks() as demo:
|
| 128 |
-
btn = gr.Button("Submit")
|
| 129 |
-
chatbot = gr.Chatbot()
|
| 130 |
-
txt = gr.Textbox()
|
| 131 |
-
checkbox = gr.Checkboxgroup(label="Things to Pack", choices = [])
|
| 132 |
-
selection_output = gr.Textbox(label="You selected")
|
| 133 |
-
|
| 134 |
-
btn.click(
|
| 135 |
-
fn = respond,
|
| 136 |
-
inputs= [txt],
|
| 137 |
-
outputs=[chatbot, checkbox]
|
| 138 |
-
)
|
| 139 |
|
|
|
|
| 140 |
|
|
|
|
|
|
| 99 |
str_top_weather = "\n".join(top_weather)
|
| 100 |
str_top_luggage = "\n".join(top_luggage)
|
| 101 |
|
| 102 |
+
messages = [{"role": "system", "content": f"You're a friendly and gen z chatbot. Base your response on the provided context: {top_weather} and {top_luggage}. Make lists into interactive checkboxes. No bullet points."}]
|
| 103 |
+
|
|
|
|
| 104 |
if history:
|
| 105 |
messages.extend(history)
|
| 106 |
|
|
|
|
| 113 |
)
|
| 114 |
|
| 115 |
return response['choices'][0]['message']['content'].strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
+
chatbot = gr.ChatInterface(respond, type = 'messages')
|
| 118 |
|
| 119 |
+
chatbot.launch(debug = True)
|