Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import pandas as pd
|
|
4 |
from transformers import pipeline
|
5 |
import torch
|
6 |
|
7 |
-
model = "
|
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 |
-
|
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 |
|