santu24 commited on
Commit
8a90371
·
verified ·
1 Parent(s): 2c8e564

Upload 3 files

Browse files
Files changed (3) hide show
  1. templates/base.html +24 -0
  2. templates/product.html +42 -0
  3. templates/rag.html +32 -0
templates/base.html ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>{% block title %}Amazon Products{% endblock %}</title>
6
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" />
7
+ <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
8
+ </head>
9
+ <body>
10
+ <nav class="navbar navbar-dark bg-dark mb-4">
11
+ <div class="container">
12
+ <a class="navbar-brand" href="{{ url_for('index') }}">
13
+ <i class="fa fa-shopping-cart"></i> Amazon Products
14
+ </a>
15
+ <a class="btn btn-secondary" href="{{ url_for('rag_index') }}">RAG Chat</a>
16
+ </div>
17
+ </nav>
18
+ <div class="container">
19
+ {% block content %}{% endblock %}
20
+ </div>
21
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
22
+ <script src="{{ url_for('static', filename='js/script.js') }}"></script>
23
+ </body>
24
+ </html>
templates/product.html ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %}
2
+ {% block title %}
3
+ {{ product.name }} - Amazon Product
4
+ {% endblock %}
5
+ {% block content %}
6
+ <a href="{{ url_for('index') }}" class="btn btn-secondary mb-3">
7
+ &larr; Back to Search
8
+ </a>
9
+
10
+ <div class="row mb-4">
11
+ <div class="col-md-4">
12
+ <img src="{{ product.image }}" alt="Product Image" class="img-fluid border" />
13
+ </div>
14
+ <div class="col-md-8">
15
+ <h2>{{ product.name }}</h2>
16
+ <p><strong>Price:</strong> {{ product.discount_price }}</p>
17
+ <p>
18
+ <a href="{{ product.link }}" target="_blank" class="btn btn-primary">View on Amazon</a>
19
+ </p>
20
+ </div>
21
+ </div>
22
+ <hr>
23
+ <h3>Top 5 Recommendations</h3>
24
+ {% if recommended %}
25
+ {% for rd in recommended %}
26
+ <div class="row mb-3 border p-2 align-items-center">
27
+ <div class="col-md-2">
28
+ <img src="{{ rd.image }}" alt="Recommended" class="img-fluid border">
29
+ </div>
30
+ <div class="col-md-10">
31
+ <h5 class="mb-1">{{ rd.name }}</h5>
32
+ <p><strong>Price:</strong> {{ rd.discount_price }}</p>
33
+ <p>
34
+ <a href="{{ rd.link }}" class="text-decoration-underline text-primary" target="_blank">View on Amazon</a>
35
+ </p>
36
+ </div>
37
+ </div>
38
+ {% endfor %}
39
+ {% else %}
40
+ <p>No recommendations found.</p>
41
+ {% endif %}
42
+ {% endblock %}
templates/rag.html ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %}
2
+ {% block title %}
3
+ RAG Chat
4
+ {% endblock %}
5
+
6
+ {% block content %}
7
+ <h2>RAG Chat</h2>
8
+ <div class="border p-3 mb-3 bg-light">
9
+ <p>You can ask queries like "show me mobiles under 5000". We do a naive DB filter, then call Gemini 1.5 Flash. Chat history is in your session.</p>
10
+ </div>
11
+
12
+ <form method="POST" action="{{ url_for('rag_query') }}" style="max-width:600px;">
13
+ <div class="input-group mb-3">
14
+ <input type="text" class="form-control" name="rag_input" placeholder="Ask your RAG-based query..." />
15
+ <button type="submit" class="btn btn-primary">Send</button>
16
+ </div>
17
+ </form>
18
+
19
+ <div class="chat-history mt-4">
20
+ {% for speaker, msg in chat_history %}
21
+ {% if speaker == "user" %}
22
+ <div class="alert alert-secondary">
23
+ <strong>You:</strong> {{ msg }}
24
+ </div>
25
+ {% else %}
26
+ <div class="alert alert-info">
27
+ <strong>Assistant:</strong> {{ msg }}
28
+ </div>
29
+ {% endif %}
30
+ {% endfor %}
31
+ </div>
32
+ {% endblock %}