elozano commited on
Commit
9eebfee
1 Parent(s): d6a25c5

Messages added

Browse files
Files changed (1) hide show
  1. app.py +21 -12
app.py CHANGED
@@ -22,18 +22,27 @@ def app():
22
  content = st.text_area("Article content:")
23
  button = st.button("Analyze")
24
  if button:
25
- with st.spinner("Analyzing article..."):
26
- prediction = news_pipe(headline, content)
27
- st.success("Article successfully analyzed!")
28
- st.markdown(
29
- f"{CATEGORY_EMOJIS[prediction['category']]} **Category**: {prediction['category']}"
30
- )
31
- st.markdown(
32
- f"{FAKE_EMOJIS[prediction['fake']]} **Fake**: {'Yes' if prediction['fake'] == 'Fake' else 'No'}"
33
- )
34
- st.markdown(
35
- f"{CLICKBAIT_EMOJIS[prediction['clickbait']]} **Clickbait**: {'Yes' if prediction['clickbait'] == 'Clickbait' else 'No'}"
36
- )
 
 
 
 
 
 
 
 
 
37
 
38
 
39
  if __name__ == "__main__":
 
22
  content = st.text_area("Article content:")
23
  button = st.button("Analyze")
24
  if button:
25
+ if headline == "" and content == "":
26
+ st.error("Please, introduce an article headline and content.")
27
+ else:
28
+ if headline == "" or content == "":
29
+ st.warning(
30
+ "Please, provide both headline and content to achieve better results."
31
+ )
32
+ else:
33
+ st.success("Article successfully analyzed!")
34
+
35
+ with st.spinner("Analyzing article..."):
36
+ prediction = news_pipe(headline, content)
37
+ st.markdown(
38
+ f"{CATEGORY_EMOJIS[prediction['category']]} **Category**: {prediction['category']}"
39
+ )
40
+ st.markdown(
41
+ f"{FAKE_EMOJIS[prediction['fake']]} **Fake**: {'Yes' if prediction['fake'] == 'Fake' else 'No'}"
42
+ )
43
+ st.markdown(
44
+ f"{CLICKBAIT_EMOJIS[prediction['clickbait']]} **Clickbait**: {'Yes' if prediction['clickbait'] == 'Clickbait' else 'No'}"
45
+ )
46
 
47
 
48
  if __name__ == "__main__":