Spaces:
Sleeping
Sleeping
madanagrawal
commited on
Commit
•
1bb6412
1
Parent(s):
79d68e2
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer
|
3 |
+
|
4 |
+
st.title('Text Summarization')
|
5 |
+
text = st.text_input
|
6 |
+
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained("madanagrawal/summarization_model")
|
8 |
+
inputs = tokenizer(text, return_tensors="pt").input_ids
|
9 |
+
|
10 |
+
from transformers import AutoModelForSeq2SeqLM
|
11 |
+
|
12 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("madanagrawal/summarizsation_model")
|
13 |
+
outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
|
14 |
+
|
15 |
+
tokenizer.decode(outputs[0], skip_special_tokens=True)
|