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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
</div>
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
</html>
|
|
|
|
| 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>LLM Prompt Tester For Research</title>
|
| 7 |
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap">
|
| 8 |
+
<style>
|
| 9 |
+
* {
|
| 10 |
+
box-sizing: border-box;
|
| 11 |
+
}
|
| 12 |
+
body {
|
| 13 |
+
font-family: 'Inter', sans-serif;
|
| 14 |
+
background: linear-gradient(to right, #ede9fe, #f3e8ff);
|
| 15 |
+
color: #374151;
|
| 16 |
+
margin: 0;
|
| 17 |
+
padding: 20px;
|
| 18 |
+
display: flex;
|
| 19 |
+
justify-content: center;
|
| 20 |
+
align-items: center;
|
| 21 |
+
min-height: 100vh;
|
| 22 |
+
}
|
| 23 |
+
.container {
|
| 24 |
+
background: #faf5ff;
|
| 25 |
+
padding: 32px;
|
| 26 |
+
border-radius: 24px;
|
| 27 |
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
| 28 |
+
width: 100%;
|
| 29 |
+
max-width: 800px;
|
| 30 |
+
border: 2px solid #c4b5fd;
|
| 31 |
+
}
|
| 32 |
+
h1 {
|
| 33 |
+
text-align: center;
|
| 34 |
+
margin-bottom: 24px;
|
| 35 |
+
font-size: 28px;
|
| 36 |
+
font-weight: 600;
|
| 37 |
+
color: #6b21a8;
|
| 38 |
+
}
|
| 39 |
+
label {
|
| 40 |
+
display: block;
|
| 41 |
+
margin: 14px 0 6px;
|
| 42 |
+
font-weight: 600;
|
| 43 |
+
color: #6b21a8;
|
| 44 |
+
}
|
| 45 |
+
textarea, select, input[type="text"] {
|
| 46 |
+
width: 100%;
|
| 47 |
+
padding: 12px;
|
| 48 |
+
margin-bottom: 16px;
|
| 49 |
+
border-radius: 10px;
|
| 50 |
+
border: 1px solid #ddd6fe;
|
| 51 |
+
font-size: 16px;
|
| 52 |
+
font-family: inherit;
|
| 53 |
+
}
|
| 54 |
+
textarea {
|
| 55 |
+
min-height: 120px;
|
| 56 |
+
resize: vertical;
|
| 57 |
+
}
|
| 58 |
+
input[type="file"] {
|
| 59 |
+
display: none;
|
| 60 |
+
}
|
| 61 |
+
.custom-file-upload {
|
| 62 |
+
display: inline-block;
|
| 63 |
+
padding: 12px 24px;
|
| 64 |
+
background-color: #8b5cf6;
|
| 65 |
+
color: white;
|
| 66 |
+
font-weight: 600;
|
| 67 |
+
border-radius: 10px;
|
| 68 |
+
cursor: pointer;
|
| 69 |
+
margin-bottom: 8px;
|
| 70 |
+
}
|
| 71 |
+
button {
|
| 72 |
+
background-color: #8b5cf6;
|
| 73 |
+
color: white;
|
| 74 |
+
font-weight: 600;
|
| 75 |
+
border: none;
|
| 76 |
+
padding: 14px;
|
| 77 |
+
border-radius: 10px;
|
| 78 |
+
font-size: 16px;
|
| 79 |
+
cursor: pointer;
|
| 80 |
+
width: 100%;
|
| 81 |
+
margin-top: 12px;
|
| 82 |
+
}
|
| 83 |
+
button:hover {
|
| 84 |
+
background-color: #7c3aed;
|
| 85 |
+
}
|
| 86 |
+
.loading {
|
| 87 |
+
font-size: 16px;
|
| 88 |
+
font-weight: bold;
|
| 89 |
+
color: #6b21a8;
|
| 90 |
+
animation: pulse 1s infinite;
|
| 91 |
+
margin: 10px 0;
|
| 92 |
+
}
|
| 93 |
+
@keyframes pulse {
|
| 94 |
+
0% { opacity: 0.3; }
|
| 95 |
+
50% { opacity: 1; }
|
| 96 |
+
100% { opacity: 0.3; }
|
| 97 |
+
}
|
| 98 |
+
pre {
|
| 99 |
+
background: #f5f3ff;
|
| 100 |
+
border: 1px solid #e9d5ff;
|
| 101 |
+
padding: 16px;
|
| 102 |
+
border-radius: 10px;
|
| 103 |
+
white-space: pre-wrap;
|
| 104 |
+
margin-top: 10px;
|
| 105 |
+
}
|
| 106 |
+
.download {
|
| 107 |
+
text-align: center;
|
| 108 |
+
margin-top: 20px;
|
| 109 |
+
}
|
| 110 |
+
</style>
|
| 111 |
+
</head>
|
| 112 |
+
<body>
|
| 113 |
+
<div class="container">
|
| 114 |
+
<h1>LLM Prompt Tester</h1>
|
| 115 |
+
|
| 116 |
+
<label for="model">Choose Model:</label>
|
| 117 |
+
<select id="model">
|
| 118 |
+
<option value="google/gemma-3n-e2b-it:free">Google Gemma</option>
|
| 119 |
+
<option value="deepseek/deepseek-r1:free">DeepSeek Chat v3</option>
|
| 120 |
+
</select>
|
| 121 |
+
|
| 122 |
+
<label for="prompt">Enter a Prompt:</label>
|
| 123 |
+
<textarea id="prompt" placeholder="Type a prompt here..."></textarea>
|
| 124 |
+
|
| 125 |
+
<label for="fileUpload">Or upload prompts from a file (.txt/.csv):</label>
|
| 126 |
+
<label class="custom-file-upload">
|
| 127 |
+
<input type="file" id="fileUpload" accept=".txt,.csv"/>
|
| 128 |
+
Choose File
|
| 129 |
+
</label>
|
| 130 |
+
<p id="fileName" class="file-name">No file selected</p>
|
| 131 |
+
|
| 132 |
+
<button onclick="send()">Send Prompt</button>
|
| 133 |
+
|
| 134 |
+
<div id="loading" class="loading" style="display:none;">⏳ Processing prompts... Please wait.</div>
|
| 135 |
+
|
| 136 |
+
<h3>Response:</h3>
|
| 137 |
+
<pre id="response"></pre>
|
| 138 |
+
|
| 139 |
+
<div class="download">
|
| 140 |
+
<button onclick="downloadCSV()">Download Results as CSV</button>
|
| 141 |
</div>
|
| 142 |
+
</div>
|
| 143 |
+
|
| 144 |
+
<script>
|
| 145 |
+
const results = [];
|
| 146 |
+
const key = 'YOUR_OPENROUTER_API_KEY'; // replace this with your actual key
|
| 147 |
+
|
| 148 |
+
document.getElementById('fileUpload').addEventListener('change', async function () {
|
| 149 |
+
const file = this.files[0];
|
| 150 |
+
const fileNameDisplay = document.getElementById('fileName');
|
| 151 |
+
fileNameDisplay.textContent = file ? file.name : 'No file selected';
|
| 152 |
+
if (!file) return;
|
| 153 |
+
|
| 154 |
+
const text = await file.text();
|
| 155 |
+
const prompts = text.split(/\r?\n/).filter(Boolean);
|
| 156 |
+
document.getElementById('loading').style.display = 'block';
|
| 157 |
+
|
| 158 |
+
for (const prompt of prompts) {
|
| 159 |
+
await send(prompt);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
document.getElementById('loading').style.display = 'none';
|
| 163 |
+
});
|
| 164 |
+
|
| 165 |
+
async function send(overridePrompt) {
|
| 166 |
+
const model = document.getElementById("model").value;
|
| 167 |
+
const prompt = overridePrompt || document.getElementById("prompt").value;
|
| 168 |
+
if (!prompt) return;
|
| 169 |
+
|
| 170 |
+
document.getElementById('loading').style.display = 'block';
|
| 171 |
+
|
| 172 |
+
const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
|
| 173 |
+
method: "POST",
|
| 174 |
+
headers: {
|
| 175 |
+
"Authorization": "Bearer " + key,
|
| 176 |
+
"Content-Type": "application/json",
|
| 177 |
+
"HTTP-Referer": "https://huggingface.co/spaces/studycode129/Free_Web_LLM_Tester"
|
| 178 |
+
},
|
| 179 |
+
body: JSON.stringify({
|
| 180 |
+
model,
|
| 181 |
+
messages: [{ role: "user", content: prompt }],
|
| 182 |
+
temperature: 0.7
|
| 183 |
+
})
|
| 184 |
+
});
|
| 185 |
+
|
| 186 |
+
const data = await res.json();
|
| 187 |
+
const output = data.choices?.[0]?.message?.content || JSON.stringify(data);
|
| 188 |
+
document.getElementById("response").textContent = output;
|
| 189 |
+
|
| 190 |
+
results.push({ model, prompt, output });
|
| 191 |
+
document.getElementById('loading').style.display = 'none';
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
function downloadCSV() {
|
| 195 |
+
let csv = "Model,Prompt,Output\n";
|
| 196 |
+
results.forEach(row => {
|
| 197 |
+
csv += `"${row.model}","${row.prompt.replace(/\n/g, " ")}","${row.output.replace(/\n/g, " ")}"\n`;
|
| 198 |
+
});
|
| 199 |
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
| 200 |
+
const link = document.createElement("a");
|
| 201 |
+
link.href = URL.createObjectURL(blob);
|
| 202 |
+
link.download = "llm_test_results.csv";
|
| 203 |
+
link.click();
|
| 204 |
+
}
|
| 205 |
+
</script>
|
| 206 |
+
</body>
|
| 207 |
</html>
|