Spaces:
Runtime error
Runtime error
Commit
·
4b97b7c
1
Parent(s):
edd0a27
Update app.py
Browse files
app.py
CHANGED
@@ -50,10 +50,11 @@ def summ_bert(text):
|
|
50 |
def para_t5(text):
|
51 |
encoding = t5_para_tokenizer.encode(text, padding='longest', return_tensors='pt')
|
52 |
outputs = t5_para_model.generate(
|
53 |
-
input_ids=encoding["input_ids"],
|
54 |
-
|
|
|
55 |
do_sample=True,
|
56 |
-
top_k=
|
57 |
top_p=0.95,
|
58 |
early_stopping=True,
|
59 |
num_return_sequences=5)
|
@@ -67,8 +68,8 @@ def para_t5(text):
|
|
67 |
def summarize(text):
|
68 |
t5_ = summ_t5(text)
|
69 |
#bert_ = summ_bert(text)
|
70 |
-
para_ = para_t5(t5_)
|
71 |
-
return t5_
|
72 |
|
73 |
if __name__ == "__main__":
|
74 |
with gr.Blocks() as demo:
|
@@ -79,6 +80,6 @@ if __name__ == "__main__":
|
|
79 |
with gr.Column():
|
80 |
t5_output = gr.Textbox(label="T5 Base Output")
|
81 |
#bert_output = gr.Textbox(label="Bert Base Output")
|
82 |
-
para_output = gr.Textbox(label="T5 Paraphrase Output")
|
83 |
-
analyze_button.click(summarize, input_text, [t5_output
|
84 |
demo.launch()
|
|
|
50 |
def para_t5(text):
|
51 |
encoding = t5_para_tokenizer.encode(text, padding='longest', return_tensors='pt')
|
52 |
outputs = t5_para_model.generate(
|
53 |
+
input_ids=encoding["input_ids"],
|
54 |
+
attention_mask=encoding["attention_mask"],
|
55 |
+
max_length=100,
|
56 |
do_sample=True,
|
57 |
+
top_k=120,
|
58 |
top_p=0.95,
|
59 |
early_stopping=True,
|
60 |
num_return_sequences=5)
|
|
|
68 |
def summarize(text):
|
69 |
t5_ = summ_t5(text)
|
70 |
#bert_ = summ_bert(text)
|
71 |
+
#para_ = para_t5(t5_)
|
72 |
+
return t5_
|
73 |
|
74 |
if __name__ == "__main__":
|
75 |
with gr.Blocks() as demo:
|
|
|
80 |
with gr.Column():
|
81 |
t5_output = gr.Textbox(label="T5 Base Output")
|
82 |
#bert_output = gr.Textbox(label="Bert Base Output")
|
83 |
+
#para_output = gr.Textbox(label="T5 Paraphrase Output")
|
84 |
+
analyze_button.click(summarize, input_text, [t5_output])
|
85 |
demo.launch()
|