Spaces:
Sleeping
Sleeping
Initial Version
Browse files
app.py
CHANGED
@@ -1,15 +1,17 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
4 |
-
tokenizer = AutoTokenizer.from_pretrained("Waris01/google-t5-finetuning-text-summarization")
|
5 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("Waris01/google-t5-finetuning-text-summarization")
|
6 |
|
7 |
-
# Input text for summarization
|
8 |
-
text = "Printed Round Neck Cotton Oversize Half sleeves Co-ord set Tracksuit For Men-P-MACK52845"
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
print(summary)
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
pipe = pipeline("summarization", model="facebook/bart-large-cnn")
|
|
|
|
|
5 |
|
|
|
|
|
6 |
|
7 |
+
def process(text):
|
8 |
+
return pipe(text, max_length=65, min_length=10, do_sample=False, clean_up_tokenization_spaces=True, truncation=True)
|
9 |
+
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=process,
|
12 |
+
inputs=gr.Textbox(label="Input Text"),
|
13 |
+
outputs="json"
|
14 |
+
)
|
15 |
+
|
16 |
+
demo.launch(share=True)
|
17 |
|
|