asv7j commited on
Commit
1026144
1 Parent(s): 3e492f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -158,6 +158,7 @@ def greet_json():
158
 
159
  async function sendMessage() {
160
  const userInput = document.getElementById('userInput').value;
 
161
  const tokenLength = parseInt(document.getElementById('tokenLength').value);
162
  if (!userInput || isNaN(tokenLength)) {
163
  alert('Please enter a valid message and token length.');
@@ -198,7 +199,7 @@ def greet_json():
198
  llm = Llama.from_pretrained(
199
  repo_id="Qwen/Qwen2.5-1.5B-Instruct-GGUF",
200
  filename="qwen2.5-1.5b-instruct-q8_0.gguf",
201
- verbose=True,n_ctx=2048
202
  )
203
  tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-1.5B-Instruct")
204
 
@@ -220,12 +221,8 @@ def chat(req: Message):
220
 
221
  @app.post("/setSystemPrompt")
222
  def chat(req: System):
223
- messages.append({"role": "user", "content": req.sys_prompt})
224
- return {"response": "System has been set"}
225
-
226
- @app.post("/clear_chat")
227
- def clear_chat():
228
  global conversation_history
229
  conversation_history = []
230
- return {"message": "Chat history cleared"}
231
-
 
 
158
 
159
  async function sendMessage() {
160
  const userInput = document.getElementById('userInput').value;
161
+ document.getElementById("userInput").reset();
162
  const tokenLength = parseInt(document.getElementById('tokenLength').value);
163
  if (!userInput || isNaN(tokenLength)) {
164
  alert('Please enter a valid message and token length.');
 
199
  llm = Llama.from_pretrained(
200
  repo_id="Qwen/Qwen2.5-1.5B-Instruct-GGUF",
201
  filename="qwen2.5-1.5b-instruct-q8_0.gguf",
202
+ verbose=True,n_ctx=1024
203
  )
204
  tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-1.5B-Instruct")
205
 
 
221
 
222
  @app.post("/setSystemPrompt")
223
  def chat(req: System):
 
 
 
 
 
224
  global conversation_history
225
  conversation_history = []
226
+ messages.append({"role": "user", "content": req.sys_prompt})
227
+ return {"response": "System has been set"}
228
+