Spaces:
Sleeping
Sleeping
| <html> | |
| <head> | |
| <title>Review Sentiment Analysis</title> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> | |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --color-teal: #5BA082; | |
| --color-lime: #9DC25C; | |
| --color-orange: #D18B5C; | |
| --color-pink: #D29BB5; | |
| --color-sage: #A3A899; | |
| --color-rose: #D5658D; | |
| --color-charcoal: #5B5958; | |
| --color-mint: #A8DCC1; | |
| --color-seafoam: #8EC4B3; | |
| --color-beige: #BFB5A0; | |
| } | |
| body { | |
| background: linear-gradient(135deg, var(--color-teal) 0%, var(--color-sage) 30%, var(--color-beige) 100%); | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| min-height: 100vh; | |
| } | |
| .main-container { | |
| display: flex; align-items: center; justify-content: center; | |
| min-height: 100vh; padding: 20px; | |
| } | |
| .prediction-card { | |
| background: rgba(255,255,255,0.95); | |
| backdrop-filter: blur(15px); | |
| border-radius: 24px; | |
| padding: 40px; | |
| width: 100%; max-width: 650px; | |
| box-shadow: 0 20px 50px rgba(0,0,0,0.1); | |
| position: relative; | |
| } | |
| .title-section { text-align: center; margin-bottom: 30px; } | |
| .main-title { font-size: 2.5rem; font-weight: 700; color: var(--color-teal); } | |
| .subtitle { color: var(--color-charcoal); font-size: 1.2rem; } | |
| .form-control { | |
| border: 2px solid var(--color-sage); | |
| border-radius: 16px; | |
| padding: 14px; | |
| font-size: 1rem; | |
| } | |
| .submit-btn { | |
| background: var(--color-teal); border: none; color: white; | |
| padding: 16px; border-radius: 50px; font-size: 1.2rem; | |
| font-weight: 700; width: 100%; | |
| transition: background 0.3s ease; | |
| } | |
| .submit-btn:hover { | |
| background: var(--color-seafoam); | |
| } | |
| .prediction-result { | |
| margin-top: 30px; padding: 20px; | |
| border-radius: 16px; text-align: center; | |
| } | |
| .prediction-result.positive { color: var(--color-teal); } | |
| .prediction-result.negative { color: var(--color-rose); } | |
| .prediction-result.neutral { color: var(--color-charcoal); } | |
| .confidence-bar { height: 8px; border-radius: 4px; overflow: hidden; margin-top: 10px; background: #ddd; } | |
| .confidence-fill { height: 100%; transition: width 0.5s ease; } | |
| .confidence-fill.positive { background: linear-gradient(90deg,var(--color-mint),var(--color-teal)); } | |
| .confidence-fill.negative { background: linear-gradient(90deg,var(--color-rose),var(--color-pink)); } | |
| .confidence-fill.neutral { background: linear-gradient(90deg,var(--color-sage),var(--color-beige)); } | |
| .model-label { | |
| margin-top: 15px; font-size: 0.95rem; | |
| color: var(--color-charcoal); opacity: 0.85; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="main-container"> | |
| <div class="prediction-card"> | |
| <div class="title-section"> | |
| <h1 class="main-title">TranSenti</h1> | |
| <p class="subtitle">Analyze the sentiment of your review</p> | |
| </div> | |
| <form method="POST" id="predictionForm"> | |
| <div class="mb-3"> | |
| <label for="review" class="form-label"><i class="fas fa-comment-dots"></i> Enter your review:</label> | |
| <textarea name="review" id="review" class="form-control" rows="4" placeholder="E.g. This product is great!" required>{{ review or '' }}</textarea> | |
| </div> | |
| <button type="submit" class="submit-btn"> | |
| <i class="fas fa-search"></i> Predict Sentiment | |
| </button> | |
| </form> | |
| {% if prediction %} | |
| <div class="prediction-result {{ prediction|lower }}"> | |
| <h4><i class="fas fa-bullseye"></i> Prediction: {{ prediction }}</h4> | |
| <p><strong>Confidence:</strong> {{ "%.2f"|format(confidence) }}%</p> | |
| <div class="confidence-bar"> | |
| <div class="confidence-fill {{ prediction|lower }}" style="width: {{ "%.2f"|format(confidence) }}%"></div> | |
| </div> | |
| <p class="model-label"><i class="fas fa-robot"></i> Model used: <strong>{{ chosen_model }}</strong></p> | |
| </div> | |
| {% endif %} | |
| <!-- Navigation Button --> | |
| <div class="text-center mt-4"> | |
| <a href="{{ url_for('batch_review') }}" class="btn btn-outline-secondary"> | |
| <i class="fas fa-list"></i> Go to Batch Prediction | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| </body> | |
| </html> | |