Lauraayu commited on
Commit
203fe06
·
verified ·
1 Parent(s): 75f81b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -12
app.py CHANGED
@@ -4,7 +4,7 @@ import torch
4
 
5
  # Define the summarization pipeline
6
  summarizer_ntg = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-summarize-news")
7
- model_bb = pipeline("Lauraayu/News_Classi_Model")
8
 
9
  # Streamlit application title
10
  st.title("News Article Summarizer and Classifier")
@@ -17,16 +17,6 @@ text = st.text_area("Enter the news article text here:")
17
  if st.button("Classify"):
18
  # Perform text summarization
19
  summary = summarizer_ntg(text)[0]['summary_text']
20
-
21
- # Perform text classification
22
- with torch.no_grad():
23
- outputs = model_bb(**summary)
24
-
25
- # Get the predicted label
26
- predicted_label_id = torch.argmax(outputs.logits, dim=-1).item()
27
- label_mapping = model_bb.config.id2label
28
- predicted_label = label_mapping[predicted_label_id]
29
-
30
  # Display the summary and classification result
31
  st.write("Summary:", summary)
32
- st.write("Category:", predicted_label)
 
4
 
5
  # Define the summarization pipeline
6
  summarizer_ntg = pipeline("text2text-generation", model="mrm8488/t5-base-finetuned-summarize-news")
7
+
8
 
9
  # Streamlit application title
10
  st.title("News Article Summarizer and Classifier")
 
17
  if st.button("Classify"):
18
  # Perform text summarization
19
  summary = summarizer_ntg(text)[0]['summary_text']
20
+
 
 
 
 
 
 
 
 
 
21
  # Display the summary and classification result
22
  st.write("Summary:", summary)