Spaces:
Running

pcostypeprediction / PCOSpred.html
nivith's picture
Upload 4 files
2596f0d verified
Raw History Blame Contribute Delete
8.91 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>PCOS Prediction</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet"/>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #0f172a;
color: #f1f5f9;
display: flex;
height: 100vh;
}
.sidebar {
width: 320px;
background-color: #1e293b;
display: flex;
justify-content: center;
align-items: center;
position: fixed;
height: 100vh;
top: 0;
left: 0;
}
.sidebar-content {
background-color: #0f172a;
border-radius: 18px;
padding: 60px 30px;
width: 90%;
box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
display: flex;
flex-direction: column;
align-items: center;
gap: 30px;
}
.sidebar h2 {
font-size: 20px;
font-weight: 500;
color: #f1f5f9;
text-align: center;
display: flex;
align-items: center;
gap: 12px;
}
.nav {
display: flex;
flex-direction: column;
gap: 18px;
width: 100%;
}
.nav a {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 18px;
text-decoration: none;
color: #cbd5e1;
border-radius: 8px;
font-size: 16px;
transition: background 0.2s ease;
}
.nav a:hover { background-color: #334155; }
.nav a.active { background-color: #ef4444; color: white; }
.main {
margin-left: 320px;
padding: 60px 80px;
width: 100%;
overflow-y: auto;
}
.main h1 { font-size: 28px; margin-bottom: 10px; }
form { margin-top: 30px; }
.form-row { margin-bottom: 18px; }
label { display: block; margin-bottom: 6px; color: #cbd5e1; }
input, select {
width: 100%;
padding: 10px;
border-radius: 6px;
border: none;
background-color: #1e293b;
color: #f8fafc;
}
button {
margin-top: 20px;
padding: 12px 24px;
border: none;
border-radius: 6px;
background-color: #ef4444;
color: white;
font-size: 16px;
cursor: pointer;
transition: background-color 0.2s ease;
}
button:hover { background-color: #dc2626; }
.result-box {
margin-top: 30px;
padding: 24px;
border: 2px solid #38bdf8;
border-radius: 10px;
background-color: #0f172a;
text-align: center;
font-size: 20px;
font-weight: bold;
color: #38bdf8;
display: none;
box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
animation: fadeIn 0.6s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div class="main">
<h1>PCOS Prediction</h1>
<p>Enter Your Health Details</p>
<form id="predict-form">
<!-- Inputs matching your Gradio app -->
<div class="form-row"><label>Weight</label><input type="text" id="Weight" required /></div>
<div class="form-row"><label>Height</label><input type="text" id="Height" required /></div>
<div class="form-row">
<label>Blood Group</label>
<select id="BG" required>
<option value="">-- Select --</option>
<option value="A+">A+</option><option value="A-">A-</option>
<option value="B+">B+</option><option value="B-">B-</option>
<option value="O+">O+</option><option value="O-">O-</option>
<option value="AB+">AB+</option><option value="AB-">AB-</option>
</select>
</div>
<div class="form-row"><label>BPM</label><input type="text" id="bpm" required /></div>
<div class="form-row"><label>Respiratory Rate</label><input type="text" id="RR" required /></div>
<div class="form-row">
<label>Cycle</label>
<select id="cycle" required>
<option value="">-- Select --</option>
<option value="Regular">Regular</option>
<option value="Irregular">Irregular</option>
<option value="Neutral">Neutral</option>
</select>
</div>
<div class="form-row"><label>Cycle Length</label><input type="text" id="CL" required /></div>
<div class="form-row"><label>Marraige Status(Years)</label><input type="text" id="MS" required /></div>
<div class="form-row">
<label>Pregnant</label>
<select id="Pregnant" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row"><label>Abortions</label><input type="text" id="Abortions" required /></div>
<div class="form-row"><label>Hip Circumference</label><input type="text" id="Hip" required /></div>
<div class="form-row"><label>Waist Circumference</label><input type="text" id="Waist" required /></div>
<div class="form-row">
<label>Weight Gain</label>
<select id="WG" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row">
<label>Hair Growth</label>
<select id="HG" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row">
<label>Hair Loss</label>
<select id="HL" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row">
<label>Pimples</label>
<select id="Pimples" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row">
<label>Fast Food Consumption</label>
<select id="FF" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row">
<label>Regular Exercise</label>
<select id="RE" required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
</div>
<div class="form-row"><label>BP Systolic</label><input type="text" id="BP_Systo" required /></div>
<div class="form-row"><label>BP Diastolic</label><input type="text" id="BP_Diasto" required /></div>
<button type="submit">Predict</button>
</form>
<div id="result" class="result-box"></div>
</div>
<script>
const form = document.getElementById('predict-form');
const resultBox = document.getElementById('result');
form.addEventListener('submit', async function (e) {
e.preventDefault();
const formData = {
Weight: document.getElementById('Weight').value,
Height: document.getElementById('Height').value,
BG: document.getElementById('BG').value,
bpm: document.getElementById('bpm').value,
RR: document.getElementById('RR').value,
cycle: document.getElementById('cycle').value,
CL: document.getElementById('CL').value,
MS: document.getElementById('MS').value,
Pregnant: document.getElementById('Pregnant').value,
Abortions: document.getElementById('Abortions').value,
Hip: document.getElementById('Hip').value,
Waist: document.getElementById('Waist').value,
WG: document.getElementById('WG').value,
HG: document.getElementById('HG').value,
HL: document.getElementById('HL').value,
Pimples: document.getElementById('Pimples').value,
FF: document.getElementById('FF').value,
RE: document.getElementById('RE').value,
BP_Systo: document.getElementById('BP_Systo').value,
BP_Diasto: document.getElementById('BP_Diasto').value,
};
try {
const res = await fetch('/predict', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(formData)
});
const data = await res.json();
resultBox.style.display = 'block';
if (data.prediction) {
resultBox.textContent = `Prediction: ${data.prediction}`;
} else if (data.error) {
resultBox.textContent = `Error: ${data.error}`;
}
} catch (error) {
resultBox.style.display = 'block';
resultBox.textContent = "Server error.";
}
});
</script>
</body>
</html>