Update app.py
Browse files
app.py
CHANGED
|
@@ -151,22 +151,6 @@ with gr.Blocks() as app:
|
|
| 151 |
description="Loops until the guessed question has a similarity score > 0.6."
|
| 152 |
).render()
|
| 153 |
|
| 154 |
-
with gr.Tab("Chat"):
|
| 155 |
-
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
| 156 |
-
messages = [{"role": "system", "content": system_message}]
|
| 157 |
-
for user, bot in history:
|
| 158 |
-
if user:
|
| 159 |
-
messages.append({"role": "user", "content": user})
|
| 160 |
-
if bot:
|
| 161 |
-
messages.append({"role": "assistant", "content": bot})
|
| 162 |
-
messages.append({"role": "user", "content": message})
|
| 163 |
-
|
| 164 |
-
response = ""
|
| 165 |
-
for msg in llm.chat(messages, stream=True):
|
| 166 |
-
token = msg.delta or ""
|
| 167 |
-
response += token
|
| 168 |
-
yield response
|
| 169 |
-
|
| 170 |
gr.ChatInterface(
|
| 171 |
respond,
|
| 172 |
additional_inputs=[
|
|
|
|
| 151 |
description="Loops until the guessed question has a similarity score > 0.6."
|
| 152 |
).render()
|
| 153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
gr.ChatInterface(
|
| 155 |
respond,
|
| 156 |
additional_inputs=[
|