sofzcc commited on
Commit
57adcc6
·
verified ·
1 Parent(s): d2bd15a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -22
app.py CHANGED
@@ -73,38 +73,47 @@ def classify_text(text):
73
  st.title("Fake News Detector")
74
 
75
  # Add disclaimer
76
- st.markdown("""
77
- ### Disclaimer
78
-
79
- **Important Notice:**
80
-
81
- This model was trained exclusively on news articles from Reuters. As a result, the model may be biased towards considering news from Reuters as "True" and may not accurately classify news from other sources.
82
-
83
- **Usage Warning:**
84
-
85
- - This model is intended for experimental and educational purposes only.
86
- - We do not take any responsibility for the outcomes or decisions made based on the results provided by this model.
87
- - The model should not be used for any critical or real-world applications, especially those that involve significant consequences or decision-making.
88
- - Users are encouraged to apply their own judgment and consult multiple sources when evaluating the credibility of news.
89
-
90
- **By using this model, you acknowledge and accept these terms and disclaimers.**
91
- """)
92
 
93
  st.write("Enter a news article URL below to check if it's real or fake:")
94
 
95
  news_url = st.text_area("News URL", height=100)
96
 
97
- if st.button("Evaluate"):
 
98
  if news_url:
99
  try:
100
  news_text = extract_news_text(news_url)
101
  predicted_label, probabilities = classify_text(news_text)
102
  st.write(f"The news article is predicted to be: **{predicted_label}**")
103
  except:
104
- if st.button("Evaluate"):
105
- st.write("It wasn't possible to fetch the article text. Enter the news article text below to check if it's real or fake:")
106
- news_text = st.text_area("News text", height=300)
107
- predicted_label, probabilities = classify_text(news_text)
108
- st.write(f"The news article is predicted to be: **{predicted_label}**")
 
 
 
 
 
 
 
 
109
  else:
110
  st.write("Please enter some news URL to evaluate.")
 
73
  st.title("Fake News Detector")
74
 
75
  # Add disclaimer
76
+ with st.expander("Disclaimer"):
77
+ st.markdown("""
78
+
79
+ **Important Notice:**
80
+
81
+ This model was trained exclusively on news articles from Reuters. As a result, the model may be biased towards considering news from Reuters as "True" and may not accurately classify news from other sources.
82
+
83
+ **Usage Warning:**
84
+
85
+ - This model is intended for experimental and educational purposes only.
86
+ - We do not take any responsibility for the outcomes or decisions made based on the results provided by this model.
87
+ - The model should not be used for any critical or real-world applications, especially those that involve significant consequences or decision-making.
88
+ - Users are encouraged to apply their own judgment and consult multiple sources when evaluating the credibility of news.
89
+
90
+ **By using this model, you acknowledge and accept these terms and disclaimers.**
91
+ """)
92
 
93
  st.write("Enter a news article URL below to check if it's real or fake:")
94
 
95
  news_url = st.text_area("News URL", height=100)
96
 
97
+
98
+ if st.button("Evaluate URL"):
99
  if news_url:
100
  try:
101
  news_text = extract_news_text(news_url)
102
  predicted_label, probabilities = classify_text(news_text)
103
  st.write(f"The news article is predicted to be: **{predicted_label}**")
104
  except:
105
+ st.write("It wasn't possible to fetch the article text. Enter the news article text below to check if it's real or fake.")
106
+ else:
107
+ st.write("Please enter some news URL to evaluate.")
108
+
109
+ st.write("Enter a news article text below to check if it's real or fake:")
110
+ news_text = st.text_area("News Text", height=300)
111
+ if st.button("Evaluate Text"):
112
+ if news_text:
113
+ try:
114
+ predicted_label, probabilities = classify_text(news_text)
115
+ st.write(f"The news article is predicted to be: **{predicted_label}**")
116
+ except:
117
+ st.write("It wasn't possible to asses the article text.")
118
  else:
119
  st.write("Please enter some news URL to evaluate.")