Unityraptor commited on
Commit
deb90aa
1 Parent(s): d7e74f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,11 +1,13 @@
1
  import gradio as gr
2
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
  device = "cpu"
4
 
5
  tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
6
 
7
  model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base").to(device)
8
 
 
 
9
  def paraphrase(
10
  question,
11
  num_beams=5,
@@ -36,8 +38,12 @@ def paraphrase(
36
  return res
37
 
38
 
 
 
 
 
39
  def launch(input):
40
- out = paraphrase(input)
41
  return out
42
 
43
  iface = gr.Interface(launch,
 
1
  import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
3
  device = "cpu"
4
 
5
  tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
6
 
7
  model = AutoModelForSeq2SeqLM.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base").to(device)
8
 
9
+ translation = pipeline("translation", model="facebook/nllb-200-distilled-600M", src_lang='en', tgt_lang="fr")
10
+
11
  def paraphrase(
12
  question,
13
  num_beams=5,
 
38
  return res
39
 
40
 
41
+ def summary(myinput):
42
+ myout = translation(myinput, )
43
+ return myout
44
+
45
  def launch(input):
46
+ out = summary(paraphrase(input))
47
  return out
48
 
49
  iface = gr.Interface(launch,