Spaces:
Running
Running
Commit ·
db0da6b
1
Parent(s): fd21d61
fixed
Browse files- app.py +4 -2
- conversation.py +1 -1
app.py
CHANGED
|
@@ -25,7 +25,7 @@ with gr.Blocks(css="footer {visibility: hidden}", title="ChatWebpage.com") as de
|
|
| 25 |
chatbot = gr.Chatbot().style(height=150)
|
| 26 |
|
| 27 |
msg = gr.Textbox(label="2. Chat with AI about the webpage")
|
| 28 |
-
msg.submit(conversation.user, [msg, chatbot], [msg, chatbot])
|
| 29 |
gr.Examples(["Please summarise the webpage", "What is the tone of the webpage?", "Tell me your favorite part of the webpage"], inputs=[msg])
|
| 30 |
|
| 31 |
with gr.Row():
|
|
@@ -34,7 +34,9 @@ with gr.Blocks(css="footer {visibility: hidden}", title="ChatWebpage.com") as de
|
|
| 34 |
clear_button.click(lambda: None, None, chatbot)
|
| 35 |
with gr.Column(scale=4):
|
| 36 |
submit_button = gr.Button("Submit")
|
| 37 |
-
submit_button.click(conversation.user, [msg, chatbot], [msg, chatbot])
|
|
|
|
|
|
|
| 38 |
|
| 39 |
if __name__ == "__main__":
|
| 40 |
demo.queue(concurrency_count=4)
|
|
|
|
| 25 |
chatbot = gr.Chatbot().style(height=150)
|
| 26 |
|
| 27 |
msg = gr.Textbox(label="2. Chat with AI about the webpage")
|
| 28 |
+
msg.submit(conversation.user, [msg, chatbot], [msg, chatbot]).success(conversation.bot, chatbot, chatbot)
|
| 29 |
gr.Examples(["Please summarise the webpage", "What is the tone of the webpage?", "Tell me your favorite part of the webpage"], inputs=[msg])
|
| 30 |
|
| 31 |
with gr.Row():
|
|
|
|
| 34 |
clear_button.click(lambda: None, None, chatbot)
|
| 35 |
with gr.Column(scale=4):
|
| 36 |
submit_button = gr.Button("Submit")
|
| 37 |
+
submit_button.click(conversation.user, [msg, chatbot], [msg, chatbot]).success(
|
| 38 |
+
conversation.bot, chatbot, chatbot
|
| 39 |
+
)
|
| 40 |
|
| 41 |
if __name__ == "__main__":
|
| 42 |
demo.queue(concurrency_count=4)
|
conversation.py
CHANGED
|
@@ -119,7 +119,7 @@ class Conversation:
|
|
| 119 |
# ... your existing user implementation ...
|
| 120 |
# Replace `messages` with `self.messages`
|
| 121 |
|
| 122 |
-
return
|
| 123 |
|
| 124 |
def bot(self, history):
|
| 125 |
# ... your existing bot implementation ...
|
|
|
|
| 119 |
# ... your existing user implementation ...
|
| 120 |
# Replace `messages` with `self.messages`
|
| 121 |
|
| 122 |
+
return "", history + [[user_message, None]]
|
| 123 |
|
| 124 |
def bot(self, history):
|
| 125 |
# ... your existing bot implementation ...
|