spuun commited on
Commit
fe673de
1 Parent(s): 46c38c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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
- return tokenizer.decode(outputs[0]).replace("</s>", "");
 
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()