Add application file
Browse files- .gitignore +15 -0
- LICENCE +21 -0
- README.md +38 -11
- client.py +35 -0
- requirements.txt +17 -0
.gitignore
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ignore virtual environments
|
| 2 |
+
venv/
|
| 3 |
+
myenv/
|
| 4 |
+
env/
|
| 5 |
+
|
| 6 |
+
# Ignore compiled Python files
|
| 7 |
+
__pycache__/
|
| 8 |
+
*.pyc
|
| 9 |
+
*.pyo
|
| 10 |
+
|
| 11 |
+
# Ignore Jupyter Notebook checkpoints
|
| 12 |
+
.ipynb_checkpoints/
|
| 13 |
+
|
| 14 |
+
# Ignore environment variables file
|
| 15 |
+
.env
|
LICENCE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 Abdulhameed
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the βSoftwareβ), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED βAS ISβ, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
CHANGED
|
@@ -1,14 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# π§ VeraCT Scan-like Fake News Detection System
|
| 2 |
+
|
| 3 |
+
A powerful, AI-enhanced news verification API that analyzes the credibility of news content by cross-referencing reliable sources, extracting entities, and applying reasoning from large language models. Built with FastAPI, LangChain, Groq's LLaMA-4 model, spaCy, and multiple real-time search APIs.
|
| 4 |
+
|
| 5 |
---
|
| 6 |
+
|
| 7 |
+
## π Key Features
|
| 8 |
+
|
| 9 |
+
- β
**Headline & Content Verification** using LLM + multi-source matching
|
| 10 |
+
- π **Reliable Domain Detection** from over 600+ trusted sources
|
| 11 |
+
- π§ **LLM Verdict Generation** (VERIFIED, LIKELY FAKE, or REQUIRES MORE VERIFICATION)
|
| 12 |
+
- π **Entity Extraction** with spaCy (ORG, PERSON, EVENT, etc.)
|
| 13 |
+
- π‘οΈ **Cross-checking** with [SearchAPI](https://www.searchapi.io/) and [Tavily](https://www.tavily.com/)
|
| 14 |
+
- π **.env-based API Key Security**
|
| 15 |
+
- π§ͺ API Testing endpoints for dev setup
|
| 16 |
+
|
| 17 |
---
|
| 18 |
|
| 19 |
+
## π§© Tech Stack
|
| 20 |
+
|
| 21 |
+
- **Python 3.10+**
|
| 22 |
+
- **FastAPI**
|
| 23 |
+
- **LangChain + Groq LLaMA-4**
|
| 24 |
+
- **spaCy (NER & NLP)**
|
| 25 |
+
- **SearchAPI + Tavily**
|
| 26 |
+
- **Pydantic + CORS middleware**
|
| 27 |
+
- **Uvicorn (ASGI server)**
|
| 28 |
+
|
| 29 |
+
- ## π‘οΈ License
|
| 30 |
+
|
| 31 |
+
This project is licensed under the [MIT License](LICENSE).
|
| 32 |
+
|
| 33 |
+
---
|
| 34 |
+
|
| 35 |
+
## βοΈ Setup Instructions
|
| 36 |
+
|
| 37 |
+
### 1. Clone the repository
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
git clone https://github.com/Abdulhameed556/VeraCT_Scan-like_news_verification_system_1.git
|
| 41 |
+
cd VeraCT_Scan-like_News_Verification_System
|
client.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
st.set_page_config(page_title="AI News Verifier", layout="centered")
|
| 5 |
+
|
| 6 |
+
st.title("π° AI-Powered News Verification")
|
| 7 |
+
st.write("Check if a news headline and content are truthful based on reliable sources using AI.")
|
| 8 |
+
|
| 9 |
+
# Input fields
|
| 10 |
+
headline = st.text_input("ποΈ News Headline", "")
|
| 11 |
+
content = st.text_area("π§Ύ News Content", "")
|
| 12 |
+
|
| 13 |
+
if st.button("π Verify News"):
|
| 14 |
+
if not headline or not content:
|
| 15 |
+
st.warning("β οΈ Please enter both a headline and content.")
|
| 16 |
+
else:
|
| 17 |
+
api_url = "https://news-web-application-ai-news-detector.onrender.com/verify" # <- Make sure this matches your FastAPI route
|
| 18 |
+
|
| 19 |
+
payload = {"headline": headline, "content": content}
|
| 20 |
+
|
| 21 |
+
try:
|
| 22 |
+
response = requests.post(api_url, json=payload)
|
| 23 |
+
|
| 24 |
+
if response.status_code == 200:
|
| 25 |
+
result = response.json()
|
| 26 |
+
st.success("β
News verification completed.")
|
| 27 |
+
st.subheader("π§ AI Verdict")
|
| 28 |
+
st.markdown(f"**Verdict:** {result['verdict']}")
|
| 29 |
+
st.markdown("**LLM Analysis:**")
|
| 30 |
+
st.write(result['llm_response'])
|
| 31 |
+
else:
|
| 32 |
+
st.error(f"β Server responded with status code {response.status_code}. Please try again.")
|
| 33 |
+
|
| 34 |
+
except requests.exceptions.RequestException as e:
|
| 35 |
+
st.error(f"π« Request failed: {e}")
|
requirements.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
langserve
|
| 2 |
+
fastapi
|
| 3 |
+
uvicorn
|
| 4 |
+
sse_starlette
|
| 5 |
+
bs4
|
| 6 |
+
pypdf
|
| 7 |
+
chromadb
|
| 8 |
+
faiss-cpu
|
| 9 |
+
wikipedia
|
| 10 |
+
arxiv
|
| 11 |
+
langchainhub
|
| 12 |
+
groq
|
| 13 |
+
streamlit
|
| 14 |
+
sentence_transformers
|
| 15 |
+
transformers
|
| 16 |
+
langchain_community
|
| 17 |
+
langchain_groq
|