Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,35 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Your specific model repository
|
| 5 |
MODEL_ID = "VoltIC/Automated-Text-Summarizer"
|
| 6 |
|
| 7 |
@st.cache_resource
|
| 8 |
def load_summarizer():
|
| 9 |
-
#
|
| 10 |
-
return pipeline(
|
| 11 |
-
"summarization",
|
| 12 |
-
model=MODEL_ID,
|
| 13 |
-
subfolder="summarizer_model",
|
| 14 |
-
framework="pt"
|
| 15 |
-
)
|
| 16 |
|
| 17 |
-
# The app tries to load this FIRST
|
| 18 |
summarizer = load_summarizer()
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
st.write("Model loaded successfully from subfolder!")
|
| 23 |
-
|
| 24 |
-
input_text = st.text_area("Paste your long text here...", height=300)
|
| 25 |
-
|
| 26 |
-
if st.button("Summarize"):
|
| 27 |
-
if input_text.strip():
|
| 28 |
-
with st.spinner("Processing..."):
|
| 29 |
-
# Set length for 2-3 sentence output
|
| 30 |
-
summary = summarizer(input_text, max_length=100, min_length=30)
|
| 31 |
-
st.success("Done!")
|
| 32 |
-
st.subheader("Summary")
|
| 33 |
-
st.write(summary[0]['summary_text'])
|
| 34 |
-
else:
|
| 35 |
-
st.warning("Please enter some text.")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
|
|
|
| 4 |
MODEL_ID = "VoltIC/Automated-Text-Summarizer"
|
| 5 |
|
| 6 |
@st.cache_resource
|
| 7 |
def load_summarizer():
|
| 8 |
+
# No subfolder needed anymore!
|
| 9 |
+
return pipeline("summarization", model=MODEL_ID, framework="pt")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
|
|
|
| 11 |
summarizer = load_summarizer()
|
| 12 |
|
| 13 |
+
st.title("AI Text Summarizer")
|
| 14 |
+
# ... rest of your code ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|