Spaces:
Runtime error
Runtime error
Update index.html
Browse files- index.html +10 -1
index.html
CHANGED
|
@@ -442,7 +442,11 @@
|
|
| 442 |
showToast('Please enter a prompt first!', 'error');
|
| 443 |
return;
|
| 444 |
}
|
| 445 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
setLoading(generateBtn, true);
|
| 447 |
codeOutput.textContent = "⏳ Generating code...";
|
| 448 |
|
|
@@ -473,6 +477,11 @@
|
|
| 473 |
return;
|
| 474 |
}
|
| 475 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
setLoading(explainBtn, true);
|
| 477 |
explanationContent.textContent = "⏳ Explaining code...";
|
| 478 |
|
|
|
|
| 442 |
showToast('Please enter a prompt first!', 'error');
|
| 443 |
return;
|
| 444 |
}
|
| 445 |
+
await fetch("/run/predict", {
|
| 446 |
+
method: "POST",
|
| 447 |
+
headers: {"Content-Type": "application/json"},
|
| 448 |
+
body: JSON.stringify({ data: [prompt, max_tokens, temperature, top_p] })
|
| 449 |
+
});
|
| 450 |
setLoading(generateBtn, true);
|
| 451 |
codeOutput.textContent = "⏳ Generating code...";
|
| 452 |
|
|
|
|
| 477 |
return;
|
| 478 |
}
|
| 479 |
|
| 480 |
+
await fetch("/run/explain", {
|
| 481 |
+
method: "POST",
|
| 482 |
+
headers: {"Content-Type": "application/json"},
|
| 483 |
+
body: JSON.stringify({ data: [code_text, max_tokens, temperature, top_p] })
|
| 484 |
+
});
|
| 485 |
setLoading(explainBtn, true);
|
| 486 |
explanationContent.textContent = "⏳ Explaining code...";
|
| 487 |
|