Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,8 +133,34 @@ print(top_results)
|
|
| 133 |
|
| 134 |
#Defining chatbot giving user a UI to interact, see their conversation history, and see new messages using built in gr feature
|
| 135 |
#ChatInterface requires at least one parameter(a function)
|
| 136 |
-
chatbot = gr.ChatInterface(respond,type="messages", title="AI Chatbot", theme="Taithrah/Minimal")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
#launching chatbot
|
| 139 |
-
chatbot.launch()
|
| 140 |
#You may run into errors when you're trying different models. To see the error messages, set debug to True in launch()
|
|
|
|
| 133 |
|
| 134 |
#Defining chatbot giving user a UI to interact, see their conversation history, and see new messages using built in gr feature
|
| 135 |
#ChatInterface requires at least one parameter(a function)
|
| 136 |
+
#chatbot = gr.ChatInterface(respond,type="messages", title="AI Chatbot", theme="Taithrah/Minimal")
|
| 137 |
+
|
| 138 |
+
# INTERFACE EDITS #
|
| 139 |
+
custom_css = """
|
| 140 |
+
#chatbox {background-color: #ffffff; border-radius: 10px; padding: 10px;}
|
| 141 |
+
#chatbox .message.user {background-color: #EDE7F6; color: #4A148C; border-radius: 20px; padding: 10px; margin: 5px; max-width: 75%;}
|
| 142 |
+
#chatbox .message.bot {background-color: #F3E5F5; color: #4A148C; border-radius: 20px; padding: 10px; margin: 5px; max-width: 75%;}
|
| 143 |
+
#header {background-color: #8E24AA; color: white; padding: 12px; border-radius: 12px 12px 0 0; font-weight: bold;}
|
| 144 |
+
.choice-btn {background-color: #BA68C8; color: white; border-radius: 20px; padding: 5px 12px; margin: 5px; cursor: pointer;}
|
| 145 |
+
.choice-btn:hover {background-color: #9C27B0;}
|
| 146 |
+
"""
|
| 147 |
+
|
| 148 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 149 |
+
gr.HTML("<div id='header'>DivaBot</div>")
|
| 150 |
+
|
| 151 |
+
chatbot = gr.Chatbot(elem_id="chatbox", height=400)
|
| 152 |
+
|
| 153 |
+
with gr.Row():
|
| 154 |
+
msg = gr.Textbox(placeholder="Type your message here...")
|
| 155 |
+
send = gr.Button("Send")
|
| 156 |
+
|
| 157 |
+
# Hook up to your existing respond() function
|
| 158 |
+
msg.submit(respond, [msg, chatbot], [chatbot, msg])
|
| 159 |
+
send.click(respond, [msg, chatbot], [chatbot, msg])
|
| 160 |
+
|
| 161 |
+
demo.launch()
|
| 162 |
+
|
| 163 |
|
| 164 |
#launching chatbot
|
| 165 |
+
#chatbot.launch()
|
| 166 |
#You may run into errors when you're trying different models. To see the error messages, set debug to True in launch()
|