trysem dfskGT commited on
Commit
5e227c8
0 Parent(s):

Duplicate from dfskGT/parrot-paraphraser

Browse files

Co-authored-by: dfskGT <dfskGT@users.noreply.huggingface.co>

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. .gitignore +3 -0
  3. README.md +14 -0
  4. app.py +42 -0
  5. requirements.txt +3 -0
.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.onnx filter=lfs diff=lfs merge=lfs -text
13
+ *.ot filter=lfs diff=lfs merge=lfs -text
14
+ *.parquet filter=lfs diff=lfs merge=lfs -text
15
+ *.pb filter=lfs diff=lfs merge=lfs -text
16
+ *.pt filter=lfs diff=lfs merge=lfs -text
17
+ *.pth filter=lfs diff=lfs merge=lfs -text
18
+ *.rar filter=lfs diff=lfs merge=lfs -text
19
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
20
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
21
+ *.tflite filter=lfs diff=lfs merge=lfs -text
22
+ *.tgz filter=lfs diff=lfs merge=lfs -text
23
+ *.wasm filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ .venv
2
+ .vscode
3
+ flagged
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Parrot Paraphraser
3
+ emoji: 🌖
4
+ colorFrom: purple
5
+ colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: 3.0.14
8
+ app_file: app.py
9
+ pinned: false
10
+ license: apache-2.0
11
+ duplicated_from: dfskGT/parrot-paraphraser
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from parrot import Parrot
4
+ import warnings
5
+
6
+ warnings.filterwarnings("ignore")
7
+
8
+ """
9
+ uncomment to get reproducable paraphrase generations
10
+ def random_state(seed):
11
+ torch.manual_seed(seed)
12
+ if torch.cuda.is_available():
13
+ torch.cuda.manual_seed_all(seed)
14
+
15
+ random_state(1234)
16
+ """
17
+
18
+ # Init models (make sure you init ONLY once if you integrate this to your code)
19
+ parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5")
20
+
21
+
22
+ def generate_paraphases(phrase):
23
+ para_phrases = parrot.augment(
24
+ input_phrase=phrase, use_gpu=False, max_return_phrases=10
25
+ )
26
+ return "\n".join(["- " + item[0] for item in para_phrases])
27
+
28
+
29
+ input_textbox = gr.Textbox(label="Type your sentence here", lines=5)
30
+ output_textbox = gr.Textbox(label="Paraphrases", lines=10)
31
+
32
+ demo = gr.Interface(
33
+ fn=generate_paraphases,
34
+ inputs=input_textbox,
35
+ outputs=output_textbox,
36
+ examples=[
37
+ "Can you recommed some upscale restaurants in Newyork?",
38
+ "What are the famous places we should not miss in Russia?",
39
+ ],
40
+ )
41
+
42
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==3.0.14
2
+ protobuf==3.20.1
3
+ git+https://github.com/PrithivirajDamodaran/Parrot_Paraphraser.git