CoolFace
Apppublic

AIEngineeringIsFun/ai-news-analyst

sourceHugging Faceapache-2.0updated 9mo agoView on Hugging Face
0likes
App README

AI Media Lens README 🛡️ AI Media Lens: Bias & Sentiment Tracker Project Overview

This project is an intelligent news aggregator built for the Towards AI Academy: Beginner Python for AI Engineering course. It moves beyond simple data retrieval by acting as a media literacy tool, using Large Language Models (LLMs) to analyze top headlines for political bias, sentiment, and fact-framing.


Project Utility

In an era of misinformation, understanding the "slant" of a news story is vital. This app:

  1. 1.Retrieves real-time data from the NewsAPI.
  1. 1.Analyzes the content using a specialized System Prompt in OpenAI's GPT-3.5-Turbo.
  1. 1.Identifies political leaning and potential sensationalism.
  1. 1.Limits token usage to remain cost-effective for the user.

Technical Python Implementation

The project demonstrates several core Python engineering concepts:

• API Orchestration: Uses the requests library to handle HTTP GET requests.

• Secure Credential Handling: API keys are ingested through Gradio's UI.

• Prompt Engineering: Employs a specific System Persona ("Neutral Media Analyst").

• Dynamic UI Rendering: Uses Python string formatting and Markdown.


Setup & API Requirements

To run this application, you will need two API keys:

  1. 1.NewsAPI Key: Sign up at newsapi.org(https://newsapi.org/).
  1. 1.OpenAI API Key: Obtain from OpenAI Platform(https://platform.openai.com/).

Troubleshooting

  1. 1.Invalid API Key Error

• Symptom: The app returns an error message regarding authentication.

• Solution: Ensure keys are copied correctly without extra spaces from NewsAPI and OpenAI.

  1. 1.Rate Limit Reached

• Symptom: "Rate limit reached" or "429" error.

• Solution: Check your usage limits on the provider dashboards. Free tiers have strict daily/monthly limits.

  1. 1."No articles found"

• Symptom: The app runs but the output is empty.

• Solution: Try switching categories (e.g., to "general") or check your internet connection.

  1. 1.Gradio Interface Issues

• Symptom: Page stuck on "Loading" or local port errors.

• Solution: Refresh your browser. If local, ensure port 7860 is free. On Hugging Face, check that the Space status is "Running".