Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -77,33 +77,6 @@ with gr.Blocks(fill_height=True, css=CSS) as demo:
|
|
77 |
|
78 |
with gr.Row():
|
79 |
chat_input = gr.Textbox(label="input")
|
80 |
-
|
81 |
-
def handle_click(chatbot, ep, sp, evt:gr.SelectData):
|
82 |
-
messages = [
|
83 |
-
{
|
84 |
-
'role':'system',
|
85 |
-
'content':sp
|
86 |
-
},
|
87 |
-
]
|
88 |
-
index = evt.index[0]
|
89 |
-
print(index)
|
90 |
-
for part in chatbot[:index]:
|
91 |
-
messages.extend(
|
92 |
-
[
|
93 |
-
{
|
94 |
-
'role':'user',
|
95 |
-
'content':part[0]
|
96 |
-
},
|
97 |
-
{
|
98 |
-
'role':'assistant',
|
99 |
-
'content':part[1]
|
100 |
-
}
|
101 |
-
]
|
102 |
-
)
|
103 |
-
ret = llm_infer(ep, messages, ak, sk)
|
104 |
-
print(ret)
|
105 |
-
print(chatbot[:index] + [[chatbot[index][0], ret]] + chatbot[index + 1:])
|
106 |
-
return chatbot[:index] + [[chatbot[index][0], ret]] + chatbot[index + 1:]
|
107 |
|
108 |
chat_input.submit(respond, [chat_input,chatbot, character_name, character_info, user_name, user_info],[chat_input, chatbot])
|
109 |
clear = gr.ClearButton([chat_input, chatbot],)
|
@@ -111,4 +84,4 @@ with gr.Blocks(fill_height=True, css=CSS) as demo:
|
|
111 |
|
112 |
|
113 |
|
114 |
-
demo.launch(
|
|
|
77 |
|
78 |
with gr.Row():
|
79 |
chat_input = gr.Textbox(label="input")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
chat_input.submit(respond, [chat_input,chatbot, character_name, character_info, user_name, user_info],[chat_input, chatbot])
|
82 |
clear = gr.ClearButton([chat_input, chatbot],)
|
|
|
84 |
|
85 |
|
86 |
|
87 |
+
demo.launch()
|