Spaces:
Running

File size: 8,913 Bytes
2596f0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!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>