Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		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 | |
| 1. Install the required dependencies: | |
| ``` | |
| pip install -r requirements.txt | |
| ``` | |
| 2. 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/](https://console.groq.com/) | |
| 3. Run the application: | |
| ``` | |
| python app.py | |
| ``` | |
| 4. Open the application in your web browser at the URL displayed in the terminal (typically http://127.0.0.1:7860) | |
| ## Usage | |
| 1. Upload a PDF file containing a political manifesto | |
| 2. Enter a search term to find specific mentions in the manifesto | |
| 3. Click "Analyze Manifesto" to process the document | |
| 4. 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](https://hf.co/docs/hub/spaces) 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. | |
