File size: 6,190 Bytes
f67c19c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de6e6ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f67c19c
de6e6ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f67c19c
de6e6ce
 
f67c19c
de6e6ce
 
 
f67c19c
 
 
 
 
 
 
 
 
 
 
 
 
 
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>EmoNet - Emotional Damage Scanner</title>
  <style>
    body {
      margin: 0;
      padding: 0;
      background-color: #0d1117;
      font-family: 'Poppins', sans-serif;
      color: #f1f5f9;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      min-height: 100vh;
      padding: 2rem 1rem;
    }

    h1 {
      font-size: 2rem;
      color: #00f7ff;
      text-shadow: 0 0 5px #00f7ff88;
      margin-bottom: 0.5rem;
      text-align: center;
    }

    p.description {
      font-size: 0.95rem;
      font-style: italic;
      font-weight: 300;
      color: #cbd5e1;
      margin-top: -0.25rem;
      margin-bottom: 2rem;
      text-align: center;
      max-width: 600px;
      padding: 0 1rem;
    }

    .container {
      background: #161b22;
      padding: 2rem 1rem;
      border-radius: 12px;
      max-width: 600px;
      width: 100%;
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
      box-sizing: border-box;
    }

    textarea {
      width: 100%;
      height: 100px;
      background: #0d1117;
      border: none;
      color: #f1f5f9;
      padding: 1rem;
      font-size: 1rem;
      border-radius: 10px;
      resize: none;
      outline: none;
      margin-bottom: 1rem;
      box-sizing: border-box;
    }

    button {
      width: 100%;
      background: #facc15;
      border: none;
      padding: 0.7rem;
      font-size: 1rem;
      font-weight: bold;
      color: #0d1117;
      border-radius: 8px;
      cursor: pointer;
      box-shadow: 0 0 10px #facc1544;
      transition: all 0.2s ease;
    }

    button:hover {
      background: #ff3c98;
      color: #fff;
      box-shadow: 0 0 10px #ff3c9877;
    }

    #loader {
      font-size: 0.95rem;
      color: #a1a1a1;
      text-align: center;
      margin-top: 1rem;
    }

    #result {
      margin-top: 2rem;
      text-align: center;
      font-size: 1.2rem;
      display: none;
    }

    .level {
      font-size: 1.5rem;
      margin-bottom: 0.5rem;
    }

    .bar-container {
      width: 100%;
      background: #2c2f33;
      border-radius: 10px;
      height: 20px;
      margin: 1rem auto;
      overflow: hidden;
    }

    .bar-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #00f7ff, #ff3c98);
      border-radius: 10px;
      transition: width 0.7s ease-in-out;
    }

    .emoji {
      font-size: 2rem;
      margin-top: 0.5rem;
    }

    .verdict {
      margin-top: 1rem;
      font-style: italic;
      font-size: 1.1rem;
      color: #ddd;
    }

    @media screen and (max-width: 400px) {
      h1 {
        font-size: 1.5rem;
      }

      .level {
        font-size: 1.2rem;
      }

      .verdict {
        font-size: 1rem;
      }

      textarea {
        height: 90px;
        font-size: 0.95rem;
      }

      button {
        font-size: 0.95rem;
      }
    }
  </style>
</head>
<body>
  <h1>✨ EmoNet ✨</h1>
  <p class="description">
    Journaling, but with judgment. Let EmoNet rate your trauma so you can cry more efficiently.
  </p>

  <div class="container">
    <textarea id="textInput" placeholder="type text here..."></textarea>
    <button onclick="analyze()">Analyze</button>

    <div id="loader" style="display: none;">🧠 Cooking up the roast...</div>

    <div id="result">
      <div class="level" id="damageLabel"></div>
      <div class="bar-container">
        <div class="bar-fill" id="barFill"></div>
      </div>
      <div class="emoji" id="emojiOutput"></div>
      <div class="verdict" id="roastVerdict"></div>
    </div>
  </div>

  <script>
  const levelEmoji = {
    0: "😌",
    1: "🧐",
    2: "😬",
    3: "πŸ’’",
    4: "πŸ”₯",
    5: "πŸ—ΏπŸ’€",
    6: "πŸ’€πŸ”₯🧨",
    7: "β˜ οΈπŸ“‰πŸ§ "
  };

  // βœ… Put your actual ngrok URL here (HTTPS one)
  const API_URL = "https://cf6827739654.ngrok-free.app";

  async function analyze() {
    const input = document.getElementById("textInput").value.trim();
    const result = document.getElementById("result");
    const damageLabel = document.getElementById("damageLabel");
    const barFill = document.getElementById("barFill");
    const emojiOutput = document.getElementById("emojiOutput");
    const roastVerdict = document.getElementById("roastVerdict");
    const loader = document.getElementById("loader");

    if (!input) {
      alert("Paste a roast, you lazy noodle.");
      return;
    }

    // Reset UI
    loader.style.display = "block";
    result.style.display = "none";
    barFill.style.width = "0%";
    roastVerdict.textContent = "";
    damageLabel.textContent = "Analyzing...";
    emojiOutput.textContent = "πŸ€–";

    try {
      const response = await fetch(`${API_URL}/predict`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ text: input })
      });

      const data = await response.json();

      const label = data.label || "Level ? unknown";
      const roast = data.roast || "EmoNet is speechless.";
      const level = parseInt(label.match(/\d+/)?.[0]) || 0;

      loader.style.display = "none";
      damageLabel.textContent = label;
      emojiOutput.textContent = levelEmoji[level] || "😢";
      roastVerdict.textContent = roast;
      barFill.style.width = `${(level + 1) * 12.5}%`;
      result.style.display = "block";

    } catch (err) {
      console.error(err);
      loader.style.display = "none";
      damageLabel.textContent = "πŸ’€ EmoNet crashed. Try again.";
      roastVerdict.textContent = "";
      emojiOutput.textContent = "πŸ₯€";
      result.style.display = "block";
    }
  }
</script>


  <!-- β˜• Buy Me a Coffee Widget -->
  <script data-name="BMC-Widget"
    src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js"
    data-id="juii03"
    data-description="Support me on Buy me a coffee!"
    data-message="Like this app? Roast me with caffeine β˜•"
    data-color="#ffdd00"
    data-position="Right"
    data-x_margin="18"
    data-y_margin="18">
  </script>
</body>
</html>