Emily666666 commited on
Commit
20df90f
1 Parent(s): 7d1e211

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -9,7 +9,7 @@ except ValueError as e:
9
  st.error(f"Error loading summarization model: {e}")
10
  summarizer_loaded = False
11
 
12
- # Load the news classification pipeline
13
  model_name = "elozano/bert-base-cased-news-category"
14
  try:
15
  classifier = pipeline("text-classification", model=model_name, return_all_scores=True)
@@ -19,13 +19,13 @@ except ValueError as e:
19
  classifier_loaded = False
20
 
21
  # Streamlit app title
22
- st.title("Summarization and News Classification")
23
 
24
  # Tab layout
25
- tab1, tab2 = st.tabs(["Text Summarization", "News Classification"])
26
 
27
  with tab1:
28
- st.header("Text Summarization")
29
  # Input text for summarization
30
  text_to_summarize = st.text_area("Enter text to summarize:", "")
31
  if st.button("Summarize"):
@@ -41,13 +41,13 @@ with tab1:
41
  st.warning("Please enter text to summarize and ensure the model is loaded.")
42
 
43
  with tab2:
44
- st.header("News Classification")
45
- # Input text for news classification
46
  text_to_classify = st.text_area("Enter text to classify:", "")
47
  if st.button("Classify"):
48
  if classifier_loaded and text_to_classify:
49
  try:
50
- # Perform news classification
51
  results = classifier(text_to_classify)[0]
52
  # Find the category with the highest score
53
  max_score = max(results, key=lambda x: x['score'])
 
9
  st.error(f"Error loading summarization model: {e}")
10
  summarizer_loaded = False
11
 
12
+ # Load the Question classification pipeline
13
  model_name = "elozano/bert-base-cased-news-category"
14
  try:
15
  classifier = pipeline("text-classification", model=model_name, return_all_scores=True)
 
19
  classifier_loaded = False
20
 
21
  # Streamlit app title
22
+ st.title("Long Question Summarization and Classification")
23
 
24
  # Tab layout
25
+ tab1, tab2 = st.tabs(["Question Summarization", "Question Classification"])
26
 
27
  with tab1:
28
+ st.header("Question Summarization")
29
  # Input text for summarization
30
  text_to_summarize = st.text_area("Enter text to summarize:", "")
31
  if st.button("Summarize"):
 
41
  st.warning("Please enter text to summarize and ensure the model is loaded.")
42
 
43
  with tab2:
44
+ st.header("Questions Classification")
45
+ # Input text for Question classification
46
  text_to_classify = st.text_area("Enter text to classify:", "")
47
  if st.button("Classify"):
48
  if classifier_loaded and text_to_classify:
49
  try:
50
+ # Perform uestion classification
51
  results = classifier(text_to_classify)[0]
52
  # Find the category with the highest score
53
  max_score = max(results, key=lambda x: x['score'])