Eleodor commited on
Commit
98aadf0
·
1 Parent(s): 585056f

create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ st.title("Text Summarization with Hugging Face")
5
+
6
+ # Choose model and set up pipeline
7
+ model_name = "t5-base"
8
+ summarizer = pipeline("summarization", model=model_name)
9
+
10
+ # Get user input
11
+ text = st.text_area("Enter some text to summarize:")
12
+
13
+ # If user has entered text, summarize it
14
+ if text:
15
+ summary = summarizer(text, max_length=100, min_length=30, do_sample=False)
16
+ st.write("Here is your summary:")
17
+ st.write(summary[0]["summary_text"])