0x11c11e commited on
Commit
b165de5
1 Parent(s): 5e721a6
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -2,6 +2,8 @@ from parrot import Parrot
2
  import torch
3
  import warnings
4
  warnings.filterwarnings("ignore")
 
 
5
 
6
  '''
7
  uncomment to get reproducable paraphrase generations
@@ -17,14 +19,14 @@ random_state(1234)
17
  parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
18
 
19
 
20
- phrases = ["Can you recommed some upscale restaurants in Newyork?",
21
- "What are the famous places we should not miss in Russia?"
22
- ]
 
 
 
 
 
 
23
 
24
- for phrase in phrases:
25
- print("-"*100)
26
- print("Input_phrase: ", phrase)
27
- print("-"*100)
28
- para_phrases = parrot.augment(input_phrase=phrase)
29
- for para_phrase in para_phrases:
30
- print(para_phrase)
 
2
  import torch
3
  import warnings
4
  warnings.filterwarnings("ignore")
5
+ import gradio as gr
6
+
7
 
8
  '''
9
  uncomment to get reproducable paraphrase generations
 
19
  parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
20
 
21
 
22
+ def generate_paraphrases(phrase):
23
+ para_phrases = parrot.augment(input_phrase=phrase)
24
+ return [para_phrase['phrase'] for para_phrase in para_phrases]
25
+
26
+ iface = gr.Interface(
27
+ fn=generate_paraphrases,
28
+ inputs=gr.inputs.Textbox(lines=2, placeholder='Input Phrase...'),
29
+ outputs=gr.outputs.Textbox()
30
+ )
31
 
32
+ iface.launch()