File size: 2,980 Bytes
62d2e43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86f6ee6
62d2e43
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
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Writing Feedback Tool</title>
  <style>
    body {
      font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      background: linear-gradient(to right, #e0f7fa, #f1f8e9);
      margin: 0;
      padding: 2rem;
      color: #333;
    }
    .container {
      max-width: 800px;
      margin: 0 auto;
      background: white;
      padding: 2rem;
      border-radius: 12px;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    h2 {
      text-align: center;
      color: #00796b;
    }
    label {
      font-weight: bold;
      margin-top: 1rem;
    }
    select, textarea, button {
      width: 100%;
      padding: 0.75rem;
      margin-top: 0.5rem;
      margin-bottom: 1.5rem;
      border: 1px solid #ccc;
      border-radius: 8px;
      font-size: 1rem;
    }
    button {
      background-color: #00796b;
      color: white;
      border: none;
      cursor: pointer;
      transition: background-color 0.3s;
    }
    button:hover {
      background-color: #004d40;
    }
    .feedback {
      display: none;
      background: #f9fbe7;
      padding: 1.5rem;
      border-radius: 10px;
      border-left: 6px solid #cddc39;
      margin-top: 2rem;
    }
    .feedback h3 {
      color: #558b2f;
    }
    .feedback p {
      margin: 0.5rem 0;
    }
  </style>
</head>
<body>
  <div class="container">
    <h2>Writing Feedback Tool</h2>
    <label for="exam-type">Select Exam Type:</label>
    <select id="exam-type">
      <option value="IELTS">IELTS</option>
      <option value="CBSE">CBSE</option>
      <option value="College">College Essay</option>
    </select>

    <label for="essay">Enter Student Essay (max 1000 words):</label>
    <textarea id="essay" rows="10"></textarea>

    <button onclick="getFeedback()">Get Feedback</button>

    <div id="feedback" class="feedback"></div>
  </div>

  <script>
    async function getFeedback() {
      const examType = document.getElementById('exam-type').value;
      const essay = document.getElementById('essay').value;

      const response = await fetch('https://alexvatti-english-essay-writing-analyst.hf.space/feedback', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ exam_type: examType, essay_text: essay })
      });

      const data = await response.json();
      console.log("API Response:", data);
      const feedbackDiv = document.getElementById('feedback');
      feedbackDiv.innerHTML = `
        <h3>Feedback Summary</h3>
        <p><strong>Logic & Relevance:</strong> ${data.logic}</p>
        <p><strong>Grammar & Style:</strong> ${data.grammar}</p>
        <p><strong>Score:</strong> ${data.score}</p>
        <p><strong>Suggestions:</strong> ${data.suggestions}</p>
      `;
      feedbackDiv.style.display = 'block';
    }
  </script>
</body>
</html>