Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,23 +80,15 @@ def get_top_chunks(query, chunk_embeddings, text_chunks):
|
|
| 80 |
# Return the list of most relevant chunks
|
| 81 |
return top_chunks
|
| 82 |
|
| 83 |
-
client = InferenceClient("
|
| 84 |
-
|
| 85 |
-
def respond (message, history):
|
| 86 |
-
information = get_top_chunks(message,chunk_embeddings,cleaned_chunks)
|
| 87 |
-
|
| 88 |
-
messages = [{"role": "system", "content":"You are a friendly chatbot."}]
|
| 89 |
|
|
|
|
|
|
|
| 90 |
if history:
|
| 91 |
messages.extend(history)
|
| 92 |
-
|
| 93 |
messages.append({"role": "user", "content": message})
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
messages, max_tokens = 150, temperature = 0.2
|
| 97 |
-
)
|
| 98 |
-
|
| 99 |
-
return response
|
| 100 |
|
| 101 |
chatBot = gr.ChatInterface(respond, type = "messages")
|
| 102 |
chatBot.launch()
|
|
|
|
| 80 |
# Return the list of most relevant chunks
|
| 81 |
return top_chunks
|
| 82 |
|
| 83 |
+
client = InferenceClient("Qwen/Qwen2.5-7B-Instruct-1M")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
+
def respond(message, history):
|
| 86 |
+
messages = [{"role":"system", "content": "You are a friendly chatbot."}]
|
| 87 |
if history:
|
| 88 |
messages.extend(history)
|
|
|
|
| 89 |
messages.append({"role": "user", "content": message})
|
| 90 |
+
response = client.chat_completion(messages,max_tokens=100)
|
| 91 |
+
return response["choices"][0]["message"]["content"].strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
chatBot = gr.ChatInterface(respond, type = "messages")
|
| 94 |
chatBot.launch()
|