minko186 commited on
Commit
154b403
1 Parent(s): 6d7dce8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -4,7 +4,7 @@ import pandas as pd
4
  from transformers import pipeline
5
  import torch
6
 
7
- model = "xlnet/xlnet-base-cased"
8
  generator=pipeline(task='text-generation', model=model)
9
 
10
 
@@ -23,12 +23,11 @@ def generate(text, max_length):
23
 
24
 
25
  def respond(message, history, tone="natural", max_length=512):
26
- prompt = f"Paraphrase this text in a more {tones[tone]} way: {message}"
27
  text = generate(prompt, max_length)
28
  print(text)
29
  text = text[0]["generated_text"]
30
- if prompt in text:
31
- text = text.split(":", 1)[1]
32
  return text
33
 
34
 
 
4
  from transformers import pipeline
5
  import torch
6
 
7
+ model = "GeneZC/MiniChat-2-3B"
8
  generator=pipeline(task='text-generation', model=model)
9
 
10
 
 
23
 
24
 
25
  def respond(message, history, tone="natural", max_length=512):
26
+ prompt = f"<s> [|User|]Paraphrase this text in a more {tones[tone]} way: {message} </s>[|Assistant|]"
27
  text = generate(prompt, max_length)
28
  print(text)
29
  text = text[0]["generated_text"]
30
+ text = text.split("[|Assistant|]", 1)[1]
 
31
  return text
32
 
33