Oysiyl commited on
Commit
3c24f30
1 Parent(s): e9eced9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -8,13 +8,14 @@ model = AutoModelForSeq2SeqLM.from_pretrained("Oysiyl/elvish-translator-quenya-t
8
 
9
  prefix = "translate English to Elvish: "
10
 
11
- def greet(name):
12
  inputs = tokenizer(prefix + text, return_tensors="pt").input_ids
13
  outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95)
14
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
15
  return result
16
 
17
  demo = gr.Interface(title="English to Elvish translation!",
18
- description="<p style='text-align: center'>Provide English text and let's model try to guess the text in Elvish!</p>",
19
- article = "<p style='text-align: center'>Text Translation English -> Elvish | Demo Model</p>",fn=greet, inputs="text", outputs="text")
 
20
  demo.launch()
 
8
 
9
  prefix = "translate English to Elvish: "
10
 
11
+ def predict(text):
12
  inputs = tokenizer(prefix + text, return_tensors="pt").input_ids
13
  outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95)
14
  result = tokenizer.decode(outputs[0], skip_special_tokens=True)
15
  return result
16
 
17
  demo = gr.Interface(title="English to Elvish translation!",
18
+ description="<p style='text-align: center'>Provide English text and let's model try to guess the text in Elvish!</p>",
19
+ article = "<p style='text-align: center'>Text Translation English -> Elvish | Demo Model</p>",
20
+ fn=predict, inputs="text", outputs="text")
21
  demo.launch()