Pavani2704's picture
Update app.py
1b40fc5 verified
raw
history blame
659 Bytes
import streamlit as st
import transformers
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("summarization", model="google/pegasus-xsum")
st.title("NLP APP")
option = st.sidebar.selectbox(
"Choose a task",
("Summarization", "Translation", "Emotion Detection", "Image Generation")
)
if option == "Summarization":
st.title("Text Summarization")
text = st.text_area("Enter text to summarize")
if st.button("Summarize"):
if text:
st.write("Summary:", pipe(text)[0]["summary_text"])
else:
st.write("Please enter text to summarize.")
else:
st.title("None")