0x11c11e commited on
Commit
5e721a6
1 Parent(s): 30c50c9
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from parrot import Parrot
2
+ import torch
3
+ import warnings
4
+ warnings.filterwarnings("ignore")
5
+
6
+ '''
7
+ uncomment to get reproducable paraphrase generations
8
+ def random_state(seed):
9
+ torch.manual_seed(seed)
10
+ if torch.cuda.is_available():
11
+ torch.cuda.manual_seed_all(seed)
12
+
13
+ random_state(1234)
14
+ '''
15
+
16
+ #Init models (make sure you init ONLY once if you integrate this to your code)
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)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ git+https://github.com/PrithivirajDamodaran/Parrot_Paraphraser.git
2
+ torch==2.0.1