Spaces:
Runtime error
Runtime error
Messages added
Browse files
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 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
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__":
|