This is the backend service for the TweetLab application, deployed on Google Cloud.
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the development server:
python main.pyThe backend is deployed on Google Cloud. To deploy:
- Make sure you have the Google Cloud SDK installed
- Run the deployment command:
gcloud app deployThe backend provides the following API endpoints:
/api/tweets- Get tweet data/api/analyze- Analyze tweet sentiment/api/stats- Get tweet statistics
Create a .env file with the following variables:
API_KEY=your_api_key
MODEL_PATH=path_to_model
The following model files are required:
finetuned_twitter_roberta_multi.ptregressor_model.pklreplies_model.pklretweets_model.pkllikes_model.pkltfidf_vectorizer.pkl