This Streamlit app is designed to detect whether a news article is likely fake or real based on its content. It allows users to input a news article, select a vectorizer and classifier, and then predicts the authenticity of the article.
streamlit
: For creating the web application.numpy
: For numerical computations.pandas
: For data manipulation and analysis.sklearn
: For machine learning functionalities.warnings
: For ignoring warnings.streamlit_lottie
: For displaying Lottie animations.
- Loads the dataset containing fake and real news articles from a CSV file.
- Converts the labels to binary format (0 for real, 1 for fake).
- Allows users to select a vectorizer (TF-IDF or Bag of Words) and a classifier (Linear SVM or Naive Bayes) via the sidebar.
- Trains the selected classifier model using the chosen vectorizer and the loaded dataset.
- Caches the trained model for faster access.
- Sets page configuration including title, icon, and layout.
- Displays the title and a Lottie animation.
- Hides the Streamlit style for a cleaner interface.
- Provides a text area for users to input news articles.
- Upon clicking the "Check" button, predicts the authenticity of the input news article using the trained model and displays the result.
- Run the Streamlit app using the command:
streamlit run main.py --client.showErrorDetails=false
to remove cache error messages on the Streamlit interface. - Input a news article into the text area.
- Select a vectorizer and classifier from the sidebar.
- Click the "Check" button to see the prediction result.
![image](https://private-user-images.githubusercontent.com/103480022/322271239-532e7401-1562-4369-aa90-35bfed044767.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MzIwNTQsIm5iZiI6MTcyMDUzMTc1NCwicGF0aCI6Ii8xMDM0ODAwMjIvMzIyMjcxMjM5LTUzMmU3NDAxLTE1NjItNDM2OS1hYTkwLTM1YmZlZDA0NDc2Ny5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwOVQxMzI5MTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01MWYzODM5MTE4YzRjNWU2ZTcyODU4M2VlYjc2ZGJkNTYwMjg5ZjE3YWVhMmUzNGE0ZGY2MTM0Yjk0MDQ5ZGM1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.1a-ed4bD0vMlMfu21G41gSBfhDlfTt8yg10XGxoyCP8)