Spaces:
Running
Running
Commit
·
881e01f
1
Parent(s):
d622dc0
Update index.html
Browse files- index.html +51 -22
index.html
CHANGED
|
@@ -1,24 +1,53 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
-
|
| 4 |
-
<
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
<
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width" />
|
| 6 |
+
<title>My static Space</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css" />
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div class="card">
|
| 11 |
+
<h1>Welcome to your static Space!</h1>
|
| 12 |
+
<p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
|
| 13 |
+
<p>
|
| 14 |
+
Also don't forget to check the
|
| 15 |
+
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
| 16 |
+
</p>
|
| 17 |
+
</div>
|
| 18 |
+
<div class="prompt-toolbox">
|
| 19 |
+
<h2>Prompt Toolbox Reverse Prompt Engineering Code Tool</h2>
|
| 20 |
+
<p>Use this tool to generate code based on a desired prompt. Simply enter your prompt in the input field below and click "Generate Code".</p>
|
| 21 |
+
<form>
|
| 22 |
+
<label for="prompt">Enter your prompt:</label>
|
| 23 |
+
<input type="text" id="prompt" name="prompt" />
|
| 24 |
+
<button type="button" onclick="generateCode()">Generate Code</button>
|
| 25 |
+
</form>
|
| 26 |
+
<div id="code"></div>
|
| 27 |
+
<script>
|
| 28 |
+
function generateCode() {
|
| 29 |
+
const prompt = document.getElementById("prompt").value;
|
| 30 |
+
const code = document.getElementById("code");
|
| 31 |
+
code.innerHTML = "<p>Loading...</p>";
|
| 32 |
+
fetch("https://api.openai.com/v1/engines/davinci-codex/completions", {
|
| 33 |
+
method: "POST",
|
| 34 |
+
headers: {
|
| 35 |
+
Authorization: "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
| 36 |
+
"Content-Type": "application/json",
|
| 37 |
+
},
|
| 38 |
+
body: JSON.stringify({
|
| 39 |
+
prompt: prompt,
|
| 40 |
+
max_tokens: 100,
|
| 41 |
+
stop: "\n\n",
|
| 42 |
+
}),
|
| 43 |
+
})
|
| 44 |
+
.then((response) => response.json())
|
| 45 |
+
.then((data) => {
|
| 46 |
+
code.innerHTML = "<pre><code>" + data.choices[0].text + "</code></pre>";
|
| 47 |
+
})
|
| 48 |
+
.catch((error) => {
|
| 49 |
+
code.innerHTML = "<p>Error: " + error.message + "</p>";
|
| 50 |
+
});
|
| 51 |
+
}
|
| 52 |
+
</script>
|
| 53 |
+
</div>
|