tomwatto09 commited on
Commit
12fedd3
·
verified ·
1 Parent(s): 9ef250c

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +195 -0
index.html ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
+ <title>UniSolve - Academic Assistant</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ font-family: 'Times New Roman', serif;
11
+ background-color: #f4f9ff;
12
+ color: #002b5c;
13
+ }
14
+ header {
15
+ display: flex;
16
+ align-items: center;
17
+ padding: 1rem 2rem;
18
+ background-color: #e0efff;
19
+ border-bottom: 2px solid #c0d7ef;
20
+ }
21
+ header img {
22
+ height: 60px;
23
+ margin-right: 1rem;
24
+ }
25
+ header h1 {
26
+ font-size: 2.2rem;
27
+ margin: 0;
28
+ color: #004080;
29
+ }
30
+ main {
31
+ padding: 2rem;
32
+ max-width: 900px;
33
+ margin: auto;
34
+ }
35
+ label {
36
+ font-weight: bold;
37
+ font-size: 1.2rem;
38
+ display: block;
39
+ margin-top: 1.2rem;
40
+ color: #003366;
41
+ }
42
+ textarea, select {
43
+ width: 100%;
44
+ padding: 1rem;
45
+ margin-top: 0.3rem;
46
+ border: 1px solid #aacdee;
47
+ border-radius: 10px;
48
+ font-size: 1rem;
49
+ font-family: 'Times New Roman', serif;
50
+ background-color: #ffffff;
51
+ box-shadow: 0 1px 3px rgba(0, 92, 192, 0.12);
52
+ }
53
+ button {
54
+ background-color: #005cbf;
55
+ color: white;
56
+ padding: 0.9rem 1.5rem;
57
+ font-size: 1rem;
58
+ border: none;
59
+ border-radius: 8px;
60
+ cursor: pointer;
61
+ margin-right: 1rem;
62
+ margin-top: 1rem;
63
+ transition: background-color 0.3s ease;
64
+ }
65
+ button:hover {
66
+ background-color: #004999;
67
+ }
68
+ #output {
69
+ white-space: pre-wrap;
70
+ margin-top: 2rem;
71
+ background: #ffffff;
72
+ border-radius: 10px;
73
+ padding: 1rem;
74
+ border: 1px solid #aacdee;
75
+ box-shadow: 0 1px 3px rgba(0, 92, 192, 0.08);
76
+ }
77
+ #loader {
78
+ display: none;
79
+ margin-top: 1.5rem;
80
+ font-style: italic;
81
+ color: #0072c6;
82
+ }
83
+ </style>
84
+ </head>
85
+ <body>
86
+ <header>
87
+ <img src="UniSolve-Emblem.PNG" alt="UniSolve Logo" />
88
+ <h1>UniSolve</h1>
89
+ </header>
90
+ <main>
91
+ <label for="category">Subject Category</label>
92
+ <select id="category">
93
+ <option>Arts, Humanities & Social Sciences</option>
94
+ <option>Law & Legal Studies</option>
95
+ <option>Business & Management</option>
96
+ <option>Psychology & Health</option>
97
+ <option>Media, Communication & Creative Arts</option>
98
+ <option>Education & Teaching</option>
99
+ <option>Indigenous & Global Studies</option>
100
+ <option>Social Work & Human Services</option>
101
+ <option>Criminology, Justice & Law Enforcement</option>
102
+ <option>Science & Technology</option>
103
+ </select>
104
+
105
+ <label for="citationStyle">Citation Style</label>
106
+ <select id="citationStyle">
107
+ <option>Harvard</option>
108
+ <option>APA 7th</option>
109
+ <option>AGLC</option>
110
+ <option>Chicago A (footnote)</option>
111
+ <option>Chicago B (author-date)</option>
112
+ <option>IEEE</option>
113
+ <option>MLA</option>
114
+ <option>AMA (Vancouver)</option>
115
+ </select>
116
+
117
+ <label for="caseStudy">Case Study</label>
118
+ <textarea id="caseStudy" rows="6" placeholder="Paste your case study here..."></textarea>
119
+
120
+ <label for="questions">Questions</label>
121
+ <textarea id="questions" rows="6" placeholder="Paste your assignment questions here..."></textarea>
122
+
123
+ <button onclick="generateResponse()">🧠 Generate Response</button>
124
+ <button onclick="exportToPDF()">⬇️ Export PDF</button>
125
+ <button onclick="exportToWord()">⬇️ Export Word</button>
126
+
127
+ <p id="loader">✍️ Generating your structured response. Please wait...</p>
128
+ <div id="output"></div>
129
+ </main>
130
+
131
+ <script>
132
+ const backend = "https://tomwatto09-unisolve-backend.hf.space";
133
+
134
+ async function generateResponse() {
135
+ const category = document.getElementById("category").value;
136
+ const citationStyle = document.getElementById("citationStyle").value;
137
+ const caseStudy = document.getElementById("caseStudy").value;
138
+ const questions = document.getElementById("questions").value;
139
+
140
+ document.getElementById("loader").style.display = "block";
141
+ document.getElementById("output").innerText = "";
142
+
143
+ const response = await fetch(`${backend}/generate`, {
144
+ method: "POST",
145
+ headers: { "Content-Type": "application/json" },
146
+ body: JSON.stringify({
147
+ category,
148
+ citationStyle,
149
+ caseStudy,
150
+ questions
151
+ }),
152
+ });
153
+
154
+ const data = await response.json();
155
+ document.getElementById("loader").style.display = "none";
156
+
157
+ if (data.response) {
158
+ document.getElementById("output").innerText = data.response;
159
+ } else {
160
+ document.getElementById("output").innerText = `❌ Error: ${data.error}`;
161
+ }
162
+ }
163
+
164
+ async function exportToPDF() {
165
+ const content = document.getElementById("output").innerText;
166
+ const response = await fetch(`${backend}/export/pdf`, {
167
+ method: "POST",
168
+ headers: { "Content-Type": "application/json" },
169
+ body: JSON.stringify({ content }),
170
+ });
171
+ const blob = await response.blob();
172
+ const url = window.URL.createObjectURL(blob);
173
+ const a = document.createElement("a");
174
+ a.href = url;
175
+ a.download = "UniSolve-Response.pdf";
176
+ a.click();
177
+ }
178
+
179
+ async function exportToWord() {
180
+ const content = document.getElementById("output").innerText;
181
+ const response = await fetch(`${backend}/export/word`, {
182
+ method: "POST",
183
+ headers: { "Content-Type": "application/json" },
184
+ body: JSON.stringify({ content }),
185
+ });
186
+ const blob = await response.blob();
187
+ const url = window.URL.createObjectURL(blob);
188
+ const a = document.createElement("a");
189
+ a.href = url;
190
+ a.download = "UniSolve-Response.docx";
191
+ a.click();
192
+ }
193
+ </script>
194
+ </body>
195
+ </html>