Skip to content

MuhammadAwais-32013/Article-Generator_Hackathon_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArticleSift

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.

Features

  • 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.

Technologies

  • Streamlit
  • OpenAI API (LLaMA 3.1 8b)
  • Google Custom Search API
  • Google Text-to-Speech (gTTS)

Backend

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.

Endpoints

  • /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.

Key Components

  • Article Fetching: Uses the newspaper library 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.

Setting Up the Environment

Creating a Virtual Environment

Before running the application, it's recommended to create a virtual environment to isolate dependencies and avoid conflicts with other projects.

  1. Install virtualenv (if not already installed):

    pip install virtualenv
  2. Create a virtual environment:

    virtualenv venv

    This will create a directory named venv in your project directory, containing the isolated Python environment.

  3. 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.

  4. Deactivate the virtual environment (when done):

    deactivate
  5. Install backend dependencies:

    pip install -r requirements.txt

Running the App

To run the Streamlit app:

  1. Run the Streamlit app:
    streamlit run app.py

Notes

  • Configure the API keys and endpoints according to your backend setup.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Releases

No releases published

Packages

 
 
 

Contributors

Languages