A Python-based Streamlit web app to extract, analyze, and visualize predictions from tweets using LangExtract.
- Extract predictions from tweet datasets (CSV files) using LangExtract.
- View, filter, and validate predictions interactively.
- Visualize prediction statistics and trends.
- LLM verification integration for predictions.
- Export validated predictions.
- Python 3.9+
- Streamlit
- LangExtract Python SDK
- pandas, plotly
- Clone this repository:
git clone https://github.com/yourusername/tweet-prediction-analyzer.git
cd tweet-prediction-analyzer- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the project root with the following variables:
INPUT_FOLDER=path/to/csv/folder
LANGEXTRACT_API_KEY=your_langextract_api_keyINPUT_FOLDER: Path to the folder containing your tweet CSV files.LANGEXTRACT_API_KEY: API key for LangExtract.
Your tweet CSV should have the following columns:
id,tweetText,tweetURL,type,tweetAuthor,handle,replyCount,quoteCount,retweetCount,likeCount,views,bookmarkCount,createdAt,allMediaURL,videoURL
id: Unique tweet identifiertweetText: Content of the tweettweetURL: URL of the tweettype: Type of tweet (optional)tweetAuthor: Name of the authorhandle: Twitter handlereplyCount,quoteCount,retweetCount,likeCount,views,bookmarkCount: Tweet engagement metricscreatedAt: Timestamp of the tweet (formatYYYY-MM-DD HH:MM:SS)allMediaURL,videoURL: Media links
streamlit run app.py- Open your browser at
http://localhost:8501. - Use the sidebar to manage data, run extraction, and view analytics.
tweet-prediction-analyzer/
│
├── app.py # Main Streamlit app
├── main.py # TweetPredictionAnalyzer class and extraction logic
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── README.md # Documentation
├── outputs/ # Folder for predictions and JSON files
└── data/ # CSV files (tweets)
MIT License