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}")