Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
|
|
| 40 |
|
| 41 |
response = [(message_history[i]["content"], message_history[i+1]["content"]) for i in range(1, len(message_history)-1, 2)] # Variable for the response
|
| 42 |
|
| 43 |
-
#This chunk of code basically loops through the message history so we can write it to a save file repository.
|
| 44 |
content = ''
|
| 45 |
for i in range(1,len(message_history), 1):
|
| 46 |
if (i % 2 == 1) and (message_history[i]["role"] == "user"):
|
|
@@ -50,18 +50,18 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
|
|
| 50 |
else:
|
| 51 |
content += ''
|
| 52 |
|
| 53 |
-
return response #Returning the response
|
| 54 |
|
| 55 |
-
with gr.Row(): #Creating the Row for the chatbot conversation using gradio.
|
| 56 |
|
| 57 |
-
#Create Gradio Textbox for the user to type into
|
| 58 |
txt = gr.Textbox(
|
| 59 |
show_label = False,
|
| 60 |
placeholder = initial_message,
|
| 61 |
)
|
| 62 |
|
| 63 |
-
#Adding the messages into the row with gradio.
|
| 64 |
txt.submit(predict_prompt, txt, Chatbot)
|
| 65 |
txt.submit(None, None, txt, js="() => {''}")
|
| 66 |
|
| 67 |
-
chatblock.launch() #launch!
|
|
|
|
| 40 |
|
| 41 |
response = [(message_history[i]["content"], message_history[i+1]["content"]) for i in range(1, len(message_history)-1, 2)] # Variable for the response
|
| 42 |
|
| 43 |
+
# This chunk of code basically loops through the message history so we can write it to a save file repository.
|
| 44 |
content = ''
|
| 45 |
for i in range(1,len(message_history), 1):
|
| 46 |
if (i % 2 == 1) and (message_history[i]["role"] == "user"):
|
|
|
|
| 50 |
else:
|
| 51 |
content += ''
|
| 52 |
|
| 53 |
+
return response # Returning the response
|
| 54 |
|
| 55 |
+
with gr.Row(): # Creating the Row for the chatbot conversation using gradio.
|
| 56 |
|
| 57 |
+
# Create Gradio Textbox for the user to type into
|
| 58 |
txt = gr.Textbox(
|
| 59 |
show_label = False,
|
| 60 |
placeholder = initial_message,
|
| 61 |
)
|
| 62 |
|
| 63 |
+
# Adding the messages into the row with gradio.
|
| 64 |
txt.submit(predict_prompt, txt, Chatbot)
|
| 65 |
txt.submit(None, None, txt, js="() => {''}")
|
| 66 |
|
| 67 |
+
chatblock.launch() # launch!
|