ArticleSift is a Streamlit application designed to help users fetch news articles, ask questions about them, and listen to audio versions of the content. It supports multiple languages and includes custom styling to enhance user experience.
- Fetch News Articles: Retrieve articles by entering a URL or title.
- Give Articles Link: Provides links to related articles based on user prompts.
- Ask Questions: Submit questions related to the fetched article and get AI-generated answers.
- Audio Playback: Listen to both the article and the summary in audio format.
- Multi-Language Support: Translate content into English, Urdu, Spanish, and French.
- Custom Styling: Enhanced UI with custom CSS for improved readability.
- Streamlit
- OpenAI API (LLaMA 3.1 8b)
- Google Custom Search API
- Google Text-to-Speech (gTTS)
The backend is built using Streamlit and provides endpoints for fetching articles using a URL or title provided by the user, answering questions related to the article, and generating audio in various languages. The app enables users to fetch and process news articles either by URL or title. The backend then parses the article and handles tasks such as translating the content into different languages if needed.
/article: Fetches an article by URL or title. The article is downloaded, parsed, and stored in memory. Optionally, the article text can be translated into a specified language./article_audio: Converts the fetched article text into audio format using Google Text-to-Speech (gTTS) and returns it as a streaming response./article_links: Provides links to related articles based on user prompts, allowing users to click on the link and read the article./question: Accepts a question related to the fetched article and returns an AI-generated answer. The answer can be translated into a specified language./summarize: Summarizes the fetched article text with an option to limit the number of words. The summary can also be translated into a specified language.
- Article Fetching: Uses the
newspaperlibrary to download and parse articles from a given URL. If a title is provided, it searches for relevant articles using Google Custom Search API. - Translation: Utilizes the LLaMA 3.1 model for translating text into multiple languages, enhancing accessibility for non-English speakers.
- Text-to-Speech: Converts both article text and summaries into speech using Google Text-to-Speech (gTTS), allowing users to listen to the content.
- In-Memory Storage: Keeps the fetched article and summary in memory for quick access when generating audio or answering questions.
Before running the application, it's recommended to create a virtual environment to isolate dependencies and avoid conflicts with other projects.
-
Install
virtualenv(if not already installed):pip install virtualenv
-
Create a virtual environment:
virtualenv venv
This will create a directory named
venvin your project directory, containing the isolated Python environment. -
Activate the virtual environment:
- On Windows:
.\venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
After activation, your terminal prompt should change to indicate that you are now working within the virtual environment.
- On Windows:
-
Deactivate the virtual environment (when done):
deactivate
-
Install backend dependencies:
pip install -r requirements.txt
To run the Streamlit app:
- Run the Streamlit app:
streamlit run app.py
- Configure the API keys and endpoints according to your backend setup.
This project is licensed under the MIT License - see the LICENSE file for details.