Spaces:
Runtime error
Runtime error
Commit
·
3f1b69f
1
Parent(s):
2cda37e
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ def get_response_from_chatbot(text):
|
|
| 16 |
response = resp['message']
|
| 17 |
# logger.info(f"response_: {response}")
|
| 18 |
except:
|
| 19 |
-
response = "Sorry, I'm
|
| 20 |
return response
|
| 21 |
|
| 22 |
def chat(message, chat_history):
|
|
@@ -77,15 +77,18 @@ start_work = """async() => {
|
|
| 77 |
window['chat_bot'] = window['gradioEl'].querySelectorAll('#chat_bot')[0];
|
| 78 |
window['chat_bot1'] = window['gradioEl'].querySelectorAll('#chat_bot1')[0];
|
| 79 |
chat_row = window['gradioEl'].querySelectorAll('#chat_row')[0];
|
|
|
|
| 80 |
window['chat_bot1'].children[1].textContent = '';
|
| 81 |
|
| 82 |
clientHeight = getClientHeight();
|
| 83 |
-
new_height = (clientHeight-
|
| 84 |
chat_row.style.height = new_height;
|
| 85 |
window['chat_bot'].style.height = new_height;
|
| 86 |
window['chat_bot'].children[2].style.height = new_height;
|
| 87 |
window['chat_bot1'].style.height = new_height;
|
| 88 |
window['chat_bot1'].children[2].style.height = new_height;
|
|
|
|
|
|
|
| 89 |
|
| 90 |
window['checkChange'] = function checkChange() {
|
| 91 |
try {
|
|
@@ -124,8 +127,8 @@ with gr.Blocks(title='Talk to chatGPT') as demo:
|
|
| 124 |
with gr.Row(elem_id="chat_row"):
|
| 125 |
chatbot = gr.Chatbot(elem_id="chat_bot", visible=False).style(color_map=("green", "blue"))
|
| 126 |
chatbot1 = gr.Chatbot(elem_id="chat_bot1").style(color_map=("green", "blue"))
|
| 127 |
-
with gr.Row():
|
| 128 |
-
prompt_input = gr.Textbox(lines=
|
| 129 |
chat_history = gr.Textbox(lines=4, label="prompt", visible=False)
|
| 130 |
submit_btn = gr.Button(value = "submit",elem_id="submit-btn").style(
|
| 131 |
margin=True,
|
|
|
|
| 16 |
response = resp['message']
|
| 17 |
# logger.info(f"response_: {response}")
|
| 18 |
except:
|
| 19 |
+
response = "Sorry, I'm tired."
|
| 20 |
return response
|
| 21 |
|
| 22 |
def chat(message, chat_history):
|
|
|
|
| 77 |
window['chat_bot'] = window['gradioEl'].querySelectorAll('#chat_bot')[0];
|
| 78 |
window['chat_bot1'] = window['gradioEl'].querySelectorAll('#chat_bot1')[0];
|
| 79 |
chat_row = window['gradioEl'].querySelectorAll('#chat_row')[0];
|
| 80 |
+
prompt_row = window['gradioEl'].querySelectorAll('#prompt_row')[0];
|
| 81 |
window['chat_bot1'].children[1].textContent = '';
|
| 82 |
|
| 83 |
clientHeight = getClientHeight();
|
| 84 |
+
new_height = (clientHeight-200) + 'px';
|
| 85 |
chat_row.style.height = new_height;
|
| 86 |
window['chat_bot'].style.height = new_height;
|
| 87 |
window['chat_bot'].children[2].style.height = new_height;
|
| 88 |
window['chat_bot1'].style.height = new_height;
|
| 89 |
window['chat_bot1'].children[2].style.height = new_height;
|
| 90 |
+
prompt_row,children[0].style.width = '100%';
|
| 91 |
+
prompt_row,children[0].style.flex = 'auto';
|
| 92 |
|
| 93 |
window['checkChange'] = function checkChange() {
|
| 94 |
try {
|
|
|
|
| 127 |
with gr.Row(elem_id="chat_row"):
|
| 128 |
chatbot = gr.Chatbot(elem_id="chat_bot", visible=False).style(color_map=("green", "blue"))
|
| 129 |
chatbot1 = gr.Chatbot(elem_id="chat_bot1").style(color_map=("green", "blue"))
|
| 130 |
+
with gr.Row(elem_id="prompt_row"):
|
| 131 |
+
prompt_input = gr.Textbox(lines=2, label="prompt",show_label=False)
|
| 132 |
chat_history = gr.Textbox(lines=4, label="prompt", visible=False)
|
| 133 |
submit_btn = gr.Button(value = "submit",elem_id="submit-btn").style(
|
| 134 |
margin=True,
|