Delete app.js
Browse files
app.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
| 1 |
-
const results = [];
|
| 2 |
-
|
| 3 |
-
document.getElementById('fileUpload').addEventListener('change', async function () {
|
| 4 |
-
const file = this.files[0];
|
| 5 |
-
if (!file) return;
|
| 6 |
-
|
| 7 |
-
// Show selected file name
|
| 8 |
-
document.getElementById('fileName').textContent = `Selected file: ${file.name}`;
|
| 9 |
-
|
| 10 |
-
const text = await file.text();
|
| 11 |
-
const prompts = text.split(/\r?\n/).filter(Boolean);
|
| 12 |
-
|
| 13 |
-
// Show loading animation
|
| 14 |
-
document.getElementById('loading').style.display = "block";
|
| 15 |
-
|
| 16 |
-
for (const prompt of prompts) {
|
| 17 |
-
await send(prompt);
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
// Hide loading animation
|
| 21 |
-
document.getElementById('loading').style.display = "none";
|
| 22 |
-
});
|
| 23 |
-
|
| 24 |
-
async function send() {
|
| 25 |
-
const model = document.getElementById("model").value;
|
| 26 |
-
const prompt = document.getElementById("prompt").value;
|
| 27 |
-
const loadingEl = document.getElementById("loading");
|
| 28 |
-
const outputEl = document.getElementById("responseOutput");
|
| 29 |
-
|
| 30 |
-
outputEl.textContent = "";
|
| 31 |
-
loadingEl.style.display = "block";
|
| 32 |
-
|
| 33 |
-
let responseText = "";
|
| 34 |
-
|
| 35 |
-
if (model.includes("gemma")) {
|
| 36 |
-
responseText = await callGemma(prompt);
|
| 37 |
-
} else if (model.includes("deepseek")) {
|
| 38 |
-
responseText = await callDeepSeek(prompt); // This uses DeepSeek's own API
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
loadingEl.style.display = "none";
|
| 42 |
-
outputEl.textContent = responseText;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
async function callGemma(prompt) {
|
| 48 |
-
const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
|
| 49 |
-
method: "POST",
|
| 50 |
-
headers: {
|
| 51 |
-
"Authorization": "Bearer " + "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",
|
| 52 |
-
"Content-Type": "application/json",
|
| 53 |
-
/*"HTTP-Referer": "https://huggingface.co/spaces/studycode129/Free_Web_LLM_Tester"*/
|
| 54 |
-
},
|
| 55 |
-
body: JSON.stringify({ inputs: prompt })
|
| 56 |
-
});
|
| 57 |
-
|
| 58 |
-
const result = await response.json();
|
| 59 |
-
return result[0]?.generated_text || "No response";
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
async function callDeepSeek(prompt) {
|
| 64 |
-
const response = await fetch("https://api.deepseek.com/v1/chat/completions", {
|
| 65 |
-
method: "POST",
|
| 66 |
-
headers: {
|
| 67 |
-
"Authorization": "Bearer" + "sk-13b9eb0edb6c4c7d908b14a2a196f122",
|
| 68 |
-
"Content-Type": "application/json"
|
| 69 |
-
},
|
| 70 |
-
body: JSON.stringify({
|
| 71 |
-
messages: [{ role: "user", content: prompt }]
|
| 72 |
-
})
|
| 73 |
-
});
|
| 74 |
-
|
| 75 |
-
const result = await response.json();
|
| 76 |
-
return result.choices?.[0]?.message?.content || "No response";
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
const data = await res.json();
|
| 81 |
-
const output = data.choices?.[0]?.message?.content || JSON.stringify(data);
|
| 82 |
-
document.getElementById('responseOutput').textContent = modelReply;
|
| 83 |
-
|
| 84 |
-
results.push({ model, prompt, output });
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
function downloadCSV() {
|
| 88 |
-
let csv = "Model,Prompt,Output\n";
|
| 89 |
-
results.forEach(row => {
|
| 90 |
-
csv += `"${row.model}","${row.prompt.replace(/\n/g, " ")}","${row.output.replace(/\n/g, " ")}"\n`;
|
| 91 |
-
});
|
| 92 |
-
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
| 93 |
-
const link = document.createElement("a");
|
| 94 |
-
link.href = URL.createObjectURL(blob);
|
| 95 |
-
link.download = "llm_test_results.csv";
|
| 96 |
-
link.click();
|
| 97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|