Spaces:
Running
title: Manifesto Explainer with LLM Enhancement
emoji: π
colorFrom: blue
colorTo: red
sdk: gradio
app_file: app.py
pinned: true
Manifesto Explainer with LLM Enhancement
This application analyzes political manifestos using advanced NLP and LLM techniques. It provides various insights including word frequency analysis, sentiment analysis, word clouds, and AI-generated summaries.
Features
- AI-Generated Summary: Uses Groq's LLaMA 3 model to generate concise summaries of manifestos
- Enhanced Relevant Words Analysis: Combines traditional frequency analysis with TF-IDF to find the most relevant topics
- Context-Based Search: Find specific terms within the manifesto with surrounding context
- Visualizations:
- Word Cloud: Visual representation of the most frequent words
- Sentiment Analysis: Analysis of positive, negative, and neutral sentiments
- Subjectivity Analysis: Analysis of subjective vs. objective content
- Frequency Distribution: Distribution of word frequencies
- Dispersion Plot: Visual representation of word occurrences throughout the text
Setup
Install the required dependencies:
pip install -r requirements.txt
Set up your Groq API key:
- Rename the
.env.example
file to.env
- Add your Groq API key to the
.env
file:GROQ_API_KEY=your_groq_api_key_here
- You can get a Groq API key by signing up at https://console.groq.com/
- Rename the
Run the application:
python app.py
Open the application in your web browser at the URL displayed in the terminal (typically http://127.0.0.1:7860)
Usage
- Upload a PDF file containing a political manifesto
- Enter a search term to find specific mentions in the manifesto
- Click "Analyze Manifesto" to process the document
- View the results in the different tabs:
- Summary: AI-generated summary of the manifesto
- Search Results: Occurrences of your search term with context
- Key Topics: Most relevant topics identified using LLM-enhanced analysis
- Visualizations: Various visualizations of the manifesto content
Example Manifestos
The application comes with example manifestos in the Example
folder:
- AAP Manifesto 2019
- BJP Manifesto 2019
- Congress Manifesto 2019
Note
If the Groq API key is not set up correctly, the summarization feature will be disabled, but all other features will continue to work.
Configuration
title
: string
Display title for the Space
emoji
: string
Space emoji (emoji-only character allowed)
colorFrom
: string
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
colorTo
: string
Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
sdk
: string
Can be either gradio
or streamlit
sdk_version
: string
Only applicable for streamlit
SDK.
See doc for more info on supported versions.
app_file
: string
Path to your main application file (which contains either gradio
or streamlit
Python code).
Path is relative to the root of the repository.
pinned
: boolean
Whether the Space stays on top of your list.