Loading repository dataβ¦
Loading repository dataβ¦
sudarshantanwer / repository
π¨ Full-stack hotel review sentiment analysis web app with React frontend and FastAPI backend. Uses DistilBERT AI model for real-time sentiment classification of hotel reviews. Features modern UI, RESTful API, SQLite database, and comprehensive analytics dashboard.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A full-stack web application that allows users to submit hotel reviews and automatically analyzes their sentiment using advanced NLP techniques.
git push origin mainaws-infrastructure/cloudformation/main-stack.yaml./scripts/deploy.sh prod ap-south-1
./scripts/monitor-deployment.sh # Monitor progress
π Detailed Guide: DEPLOY_AWS_CONSOLE.md
hotel-review-nlp/
βββ π backend/
β βββ π main.py # FastAPI application & routes
β βββ ποΈ models.py # SQLAlchemy database models
β βββ π§ sentiment.py # NLP sentiment analysis logic
β βββ ποΈ database.py # Database configuration & setup
β βββ π§ database_config.py # Initial data configuration
β βββ π migrations.py # Database management scripts
β βββ π¦ requirements.txt # Python dependencies
β βββ ποΈ hotel_reviews.db # SQLite database file
β βββ π data/
β β βββ π hotels.json # Sample hotel data
β βββ π __pycache__/ # Python cache files
βββ π frontend/
β βββ π index.html # Main HTML template
β βββ π¦ package.json # Node.js dependencies & scripts
β βββ βοΈ vite.config.js # Vite build configuration
β βββ π src/
β β βββ βοΈ App.jsx # Main React application
β β βββ π main.jsx # React app entry point
β β βββ π¨ index.css # Global styles
β β βββ π components/ # Reusable React components
β β β βββ π Header.jsx # App header component
β β β βββ π¨ HotelCard.jsx # Hotel display card
β β β βββ π§ Navigation.jsx# Navigation menu
β β β βββ π ReviewForm.jsx# Review submission form
β β β βββ π ReviewItem.jsx# Individual review display
β β β βββ π·οΈ SentimentBadge.jsx # Sentiment indicator
β β βββ π pages/ # Page-level components
β β β βββ π HotelDetail.jsx # Hotel details page
β β β βββ π HotelList.jsx # Hotels listing page
β β β βββ π SentimentAnalyzer.jsx # Text analysis tool
β β βββ π services/ # API communication
β β βββ π api.js # Axios API service layer
β βββ π node_modules/ # Node.js dependencies
βββ π .vscode/ # VS Code workspace configuration
β βββ βοΈ tasks.json # Build and run tasks
βββ π .gitignore # Git ignore rules
βββ π README.md # Project documentation
βββ π οΈ DEVELOPMENT.md # Development guidelines
βββ π setup.sh # Quick setup script
Navigate to backend directory:
cd backend
Create and activate virtual environment:
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
# venv\Scripts\activate
Install Python dependencies:
pip install -r requirements.txt
Initialize database (optional - auto-created on first run):
python migrations.py create
python migrations.py seed
Start the FastAPI server:
uvicorn main:app --reload --port 8000
π Backend ready at: http://localhost:8000
π API Documentation: http://localhost:8000/docs
Navigate to frontend directory:
cd frontend
Install Node.js dependencies:
npm install
Start the development server:
npm run dev
π Frontend ready at: http://localhost:5173
If you're using VS Code, you can use the predefined tasks:
Ctrl+Shift+P β "Tasks: Run Task" β "Start Backend Server"npm run dev in the frontend directory| Method | Endpoint | Description | Response |
|---|---|---|---|
GET | /hotels | Get all hotels with sentiment scores | [{id, name, location, description, avg_sentiment}] |
GET | /hotels/{hotel_id} | Get specific hotel with reviews | {hotel_details, reviews[]} |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
POST | /reviews | Submit a new review | {hotel_id, reviewer_name, review_text} |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
POST | /analyze | Analyze sentiment of text | {text: "Your text here"} |
GET /hotels:
[
{
"id": 1,
"name": "Grand Plaza Hotel",
"location": "New York, NY",
"description": "Luxury hotel in the heart of Manhattan",
"average_sentiment": 0.85,
"review_count": 12
}
]
POST /analyze:
{
"text": "Amazing hotel with excellent service!",
"sentiment": "POSITIVE",
"confidence": 0.9543,
"score": 95.43
}
β Hotel Management System
β Advanced Sentiment Analysis
β Interactive Review System
β Modern User Interface
β Full-Stack Integration
β Database Persistence
β Development Experience
distilbert-base-uncased-finetuned-sst-2-englishfrom transformers import pipeline
# Initialize sentiment pipeline
sentiment_pipeline = pipeline(
"sentiment-analysis",
model="distilbert-base-uncased-finetuned-sst-2-english",
return_all_scores=True
)
# Analyze text
result = sentiment_pipeline("Amazing hotel experience!")
# Terminal 1: Start Backend Server
cd backend
source venv/bin/activate # or .venv/bin/activate on some systems
uvicorn main:app --reload --port 8000
# Terminal 2: Start Frontend Development Server
cd frontend
npm run dev
curl -X POST "http://localhost:8000/analyze" \
-H "Content-Type: application/json" \