lruizap commited on
Commit
613c19d
·
1 Parent(s): 7a5a1bc

Actualizada la función del chatbot

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -18,7 +18,7 @@ def useZephyr(prompt):
18
  messages = [
19
  {
20
  "role": "system",
21
- "content": "You are a friendly chatbot who always responds in the style of a pirate.",
22
  },
23
  {"role": "user", "content": prompt},
24
  ]
@@ -26,7 +26,6 @@ def useZephyr(prompt):
26
  prompt = pipe.tokenizer.apply_chat_template(
27
  messages, tokenize=False, add_generation_prompt=True)
28
 
29
- # outputs = pipe(prompt, max_new_tokens=256, do_sample=True,temperature=0.7, top_k=50, top_p=0.95)
30
  outputs = pipe(prompt)
31
  return outputs[0]["generated_text"]
32
 
@@ -37,7 +36,9 @@ def generatePrompt(prompt):
37
  output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
38
  prompt = output[0]
39
 
40
- return useZephyr(prompt)
 
 
41
  #
42
 
43
  # Interface
 
18
  messages = [
19
  {
20
  "role": "system",
21
+ "content": "you are a chatbot who always responds politely and in the shortest possible way",
22
  },
23
  {"role": "user", "content": prompt},
24
  ]
 
26
  prompt = pipe.tokenizer.apply_chat_template(
27
  messages, tokenize=False, add_generation_prompt=True)
28
 
 
29
  outputs = pipe(prompt)
30
  return outputs[0]["generated_text"]
31
 
 
36
  output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
37
  prompt = output[0]
38
 
39
+ result = useZephyr(prompt)
40
+
41
+ return result
42
  #
43
 
44
  # Interface