File size: 1,426 Bytes
9c40f33 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import streamlit as st
import requests
st.set_page_config(page_title="AI News Verifier", layout="centered")
st.title("π° AI-Powered News Verification")
st.write("Check if a news headline and content are truthful based on reliable sources using AI.")
# Input fields
headline = st.text_input("ποΈ News Headline", "")
content = st.text_area("π§Ύ News Content", "")
if st.button("π Verify News"):
if not headline or not content:
st.warning("β οΈ Please enter both a headline and content.")
else:
api_url = "https://news-web-application-ai-news-detector.onrender.com/verify" # <- Make sure this matches your FastAPI route
payload = {"headline": headline, "content": content}
try:
response = requests.post(api_url, json=payload)
if response.status_code == 200:
result = response.json()
st.success("β
News verification completed.")
st.subheader("π§ AI Verdict")
st.markdown(f"**Verdict:** {result['verdict']}")
st.markdown("**LLM Analysis:**")
st.write(result['llm_response'])
else:
st.error(f"β Server responded with status code {response.status_code}. Please try again.")
except requests.exceptions.RequestException as e:
st.error(f"π« Request failed: {e}")
|