-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMLintegrate.html
More file actions
107 lines (100 loc) · 4.38 KB
/
Copy pathMLintegrate.html
File metadata and controls
107 lines (100 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Commodity Price Prediction</title>
<!-- Bootstrap CSS -->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="MLintegration.css">
</head>
<body>
<header class="bg-primary text-white text-center py-3">
<h1 class="heading">AgriBaazarConnect</h1>
</header>
<div class="container-fluid">
<div class="row">
<nav class="side-nav">
<ul>
<li><a href="login.html"><img src="src/img/login.png" alt="Login"></a></li>
<li><a href="index.html"><img src="src/img/home.png" alt="Home"></a></li>
<li><a href="product.html"><img src="src/img/products.png" alt="Products"></a></li>
<li><a href="userProfile.html"><img src="src/img/profile.png" alt="Profile"></a></li>
<li><a href="contacts.html"><img src="src/img/contact and support.png" alt="Contact"></a></li>
</ul>
</nav>
<main role="main" class="col-md-10 ml-sm-auto px-4">
<div class="container">
<h1 class="mt-4">Commodity Price Prediction</h1>
<div class="form-group">
<label for="commodity">Enter Commodity Name:</label>
<input type="text" id="commodity" name="commodity" class="form-control" placeholder="e.g., Banana">
</div>
<button onclick="predictPrice()" class="btn btn-primary">Predict Price</button>
<div id="result" class="mt-3 result"></div>
</div>
</main>
</div>
</div>
<!-- Bootstrap JS and dependencies -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<!-- Script section -->
<script>
async function predictPrice() {
const commodity = document.getElementById('commodity').value;
const resultDiv = document.getElementById('result');
if (!commodity) {
resultDiv.innerHTML = '<div class="error">Please enter a commodity name.</div>';
return;
}
try {
const response = await fetch('http://127.0.0.1:5000/predict', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ commodity }),
});
const data = await response.json();
if (data.predicted_price) {
const adjustedPrice = (data.predicted_price / 100).toFixed(2);
resultDiv.innerHTML = `<strong>Predicted Price:</strong> ₹${adjustedPrice}`;
} else {
resultDiv.innerHTML = `<div class="error">${data.error}</div>`;
}
} catch (error) {
resultDiv.innerHTML = '<div class="error">An error occurred while making the request.</div>';
}
}
</script>
<!-- Script Section -->
<script>
window.embeddedChatbotConfig = {
chatbotId: "aH1aPC-aLBVxzmJBb-WkN",
domain: "www.chatbase.co"
}
</script>
<script
src="https://www.chatbase.co/embed.min.js"
chatbotId="aH1aPC-aLBVxzmJBb-WkN"
domain="www.chatbase.co"
defer>
</script>
<div id="google_translate_element" class="gh"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement(
{pageLanguage: 'en'},
'google_translate_element'
);
}
</script>
<!-- Footer Section -->
<footer class="footer">
<p>© 2024 CodeTitans. All rights reserved.</p>
</footer>
</body>
</html>