Update app.py
Browse files
app.py
CHANGED
@@ -35,16 +35,16 @@ adequacy_score = Adequacy()
|
|
35 |
fluency_score = Fluency()
|
36 |
diversity_score= Diversity()
|
37 |
device= "cuda:0"
|
38 |
-
adequacy_threshold = 0.
|
39 |
-
fluency_threshold = 0.
|
40 |
-
diversity_ranker="levenshtein"
|
41 |
-
do_diverse=
|
42 |
#num_beam_groups (int) — Number of groups to divide num_beams into in order to ensure diversity among different groups of beams
|
43 |
# adding the model
|
44 |
|
45 |
model_name = 'tuner007/pegasus_paraphrase'
|
46 |
torch_device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
47 |
-
tokenizer = PegasusTokenizer.from_pretrained(model_name)
|
48 |
model_pegasus = PegasusForConditionalGeneration.from_pretrained(model_name).to(torch_device)
|
49 |
|
50 |
def get_max_str(lst):
|
@@ -81,7 +81,7 @@ def get_fun(Input_txt):
|
|
81 |
txt_paraphrase=txt_paraphrase+' '+tmp
|
82 |
return txt_paraphrase
|
83 |
|
84 |
-
iface = gr.Interface(fn=get_fun, inputs="text", outputs="text", title = "
|
85 |
iface.launch(inline=False)
|
86 |
|
87 |
"""# New Section"""
|
|
|
35 |
fluency_score = Fluency()
|
36 |
diversity_score= Diversity()
|
37 |
device= "cuda:0"
|
38 |
+
adequacy_threshold = 0.90# Adequacy of the English sentences
|
39 |
+
fluency_threshold = 0.80 # English Fluency
|
40 |
+
diversity_ranker="levenshtein" # Diversity (Lexical / Phrasal / Syntactical) (How much has the paraphrase changed the original sentence?)
|
41 |
+
do_diverse=False # Diverse The sentences formation
|
42 |
#num_beam_groups (int) — Number of groups to divide num_beams into in order to ensure diversity among different groups of beams
|
43 |
# adding the model
|
44 |
|
45 |
model_name = 'tuner007/pegasus_paraphrase'
|
46 |
torch_device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
47 |
+
tokenizer = PegasusTokenizer.from_pretrained(model_name) #Pre-trained Model
|
48 |
model_pegasus = PegasusForConditionalGeneration.from_pretrained(model_name).to(torch_device)
|
49 |
|
50 |
def get_max_str(lst):
|
|
|
81 |
txt_paraphrase=txt_paraphrase+' '+tmp
|
82 |
return txt_paraphrase
|
83 |
|
84 |
+
iface = gr.Interface(fn=get_fun, inputs="text", outputs="text", title = "Ai Re-Phraser Q'Hackday")
|
85 |
iface.launch(inline=False)
|
86 |
|
87 |
"""# New Section"""
|