File size: 944 Bytes
52930d0
27669e2
52930d0
bdd5038
b8c5f6f
 
52930d0
27669e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import streamlit as st
from transformers import pipeline, logging

# Suppress warnings from transformers
logging.set_verbosity_error()

# Streamlit interface setup
st.title("Summarization Test")

# Initialize the summarizer
summarizer = pipeline("summarization")

# Test summarization with a hardcoded string
test_text = "This is a simple test sentence to verify the functionality of the summarization pipeline. The goal is to ensure that the pipeline can process input text correctly and produce a summary without encountering the input type error."

if st.button('Test Summarization'):
    try:
        # Attempt to summarize the hardcoded test text
        summary = summarizer(test_text, max_length=130, min_length=30, do_sample=False)
        st.success("Summarization succeeded!")
        st.write("### Summary:")
        st.write(summary[0]['summary_text'])
    except Exception as e:
        st.error(f"Summarization test failed: {e}")