Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,8 @@ import gradio as gr
|
|
12 |
def generate(input):
|
13 |
tokenized = tokenizer(input, return_tensors="pt")["input_ids"]
|
14 |
outputs = model.generate(tokenized, max_new_tokens=80, do_sample=True, temperature=0.9)
|
15 |
-
|
|
|
16 |
|
17 |
iface = gr.Interface(fn=generate, inputs="text", outputs="text")
|
18 |
iface.launch()
|
|
|
12 |
def generate(input):
|
13 |
tokenized = tokenizer(input, return_tensors="pt")["input_ids"]
|
14 |
outputs = model.generate(tokenized, max_new_tokens=80, do_sample=True, temperature=0.9)
|
15 |
+
decoded = tokenizer.decode(outputs[0])
|
16 |
+
return decoded.slice(len(input), len(decoded)).replace("</s>", "");
|
17 |
|
18 |
iface = gr.Interface(fn=generate, inputs="text", outputs="text")
|
19 |
iface.launch()
|