DEV Community

Samuel K Quansah
Samuel K Quansah

Posted on

FanaticAI — World Cup Rivalry Obsession Engine (Powered by Google Gemini)

DEV Weekend Challenge: Passion Edition Submission

This is a submission for Weekend Challenge: Passion Edition

What I Built

I built FanaticAI: World Cup Rivalry Obsession Engine, a companion web application for devoted football (soccer) fans who want to measure their passion and simulate legendary matches.

The application offers two primary features:

  1. Fan Rant Sentiment Analyzer: Fans can type their raw, unedited, emotional rants about a match. The engine uses Google Gemini to analyze the text and output a Passion Index (0-100%) alongside a custom supportive commentator response.
  2. Rivalry Simulator Console: Users can choose two legendary national teams (e.g. Brazil vs Argentina) and configure their commentator loyalty bias. Gemini then streams a highly biased, passionate, and audio-ready match commentary stream.

Demo

(See the docs/assets/ directory in our repository for screenshots of the dashboard UI and passion gauge in action).

Code

GitHub logo samuelQUANSAH / fanatic-ai-world-cup-companion

FanaticAI: World Cup Rivalry Obsession Engine — DEV Weekend Challenge: Passion Edition entry using Google Gemini API

FanaticAI — World Cup Rivalry Obsession Engine

An interactive AI companion for devoted football fans to track sentiment, calculate fan passion index metrics, and simulate sports rivalries using the Google Gemini API.

Built for the DEV Weekend Challenge: Passion Edition (Best Use of Google AI Category).


🚀 How It Works

  • Rant Analyzer: Uses Gemini to evaluate sports rant inputs, compute a passion score (0-100), and generate supportive analyst summaries.
  • Rivalry Simulator: Simulates high-emotion commentary of matches with fan loyalty configuration.

🛠️ Stack

  • AI Platform: Google Gemini 1.5 Flash (google-generativeai SDK)
  • Backend: FastAPI (Python), Uvicorn
  • Frontend: React, TS, Vite, Tailwind CSS v4, Framer Motion

📂 Repository Layout

  • backend/: FastAPI routers, schemas, and Gemini integration handlers.
  • frontend/: Command Center dashboard with interactive sentiment gauges.
  • docs/: Holds the DEV Community submission templates (dev_submission.md).

💻 Local Setup & Run

1. Configure Environment (Backend)

How I Built It

The application is built using a modern full-stack developer architecture:

  • Backend: FastAPI (Python) and Uvicorn for fast asynchronous endpoints. We integrated the official Google Generative AI SDK (google-generativeai) to connect to the gemini-1.5-flash model.
  • Frontend: React, Vite, TypeScript, Tailwind CSS v4, and Framer Motion for a premium, responsive, dark-mode neon dashboard.

🧠 Gemini Prompts & Integration

1. Structured JSON Passion Score Estimation

We instruct Gemini to output structured JSON data directly by passing a precise scoring template:

prompt = (
    f"Analyze the following sports fan rant text: '{rant}'. "
    f"Calculate a 'passion_score' representing how obsessed, devoted, and emotional the fan is on a scale from 0 to 100. "
    f"Also write a brief 1-sentence supportive response acknowledging their obsession. "
    f"Return ONLY a clean JSON object with keys: 'passion_score' (integer) and 'response_summary' (string)."
)
Enter fullscreen mode Exit fullscreen mode

In the backend services, we configured generation_config={"response_mime_type": "application/json"} to guarantee a clean, parseable JSON block returned to the React frontend.

2. PERSONA-Biased Commentary Generation

To capture the real feeling of sports rivalries, we feed Gemini a commentator persona biased towards a specific team:

prompt = (
    f"You are a fanatical, obsessed football commentator who is highly devoted to {bias_team}. "
    f"Generate a brief, emotional, 3-sentence live commentary stream of a hypothetical match "
    f"between {team_a} and {team_b}. Your tone must show absolute passion, bias, and excitement!"
)
Enter fullscreen mode Exit fullscreen mode

Prize Categories

  • Best Use of Google AI: The entire system logic is powered by Google Gemini 1.5 Flash to perform structured sentiment scoring and persona-driven creative content generation.

Top comments (0)