File size: 2,348 Bytes
d59fcb5 0d92137 11f5144 c2d5ffe 11f5144 0d92137 11f5144 0636048 c2d5ffe 11f5144 0d92137 11f5144 fac66ea 0d92137 11f5144 0d92137 c2d5ffe 0d92137 11f5144 0d92137 d59fcb5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Generate Text Stream - HuggingFace.js Live Examples</title>
<link rel="stylesheet" href="/main.css" />
<link rel="stylesheet" href="/pico.classless.min.css" />
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="app" class="container">
<h1>Generate Text Stream with Vue</h1>
<div class="grid grid-cols-2 gap-2">
<div>
<label for="hf-token"
>Hugging Face Token (optional but limited if absent)</label
>
<input
id="hf-token"
v-model="token"
placeholder="HF-TOKEN"
type="password"
/>
</div>
<div>
<label for="model-select">Select a model</label>
<select id="model-select" v-model="selectedModel">
<option v-for="model in models" :value="model">{{ model }}</option>
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-2">
<div>
<label for="response-length">Response Length</label>
<select id="response-length" v-model="responseLength">
<option value="50">Short</option>
<option value="150">Medium</option>
<option value="250">Long</option>
</select>
</div>
<div>
<label for="temp">Temperature (Controls Randomness)</label>
<select id="temp" v-model="temperature">
<option value="1.0">1.0</option>
<option value="0.7">0.7</option>
<option value="0.5">0.5</option>
<option value="0.3">0.3</option>
<option value="0.1">0.1</option>
</select>
</div>
</div>
<label for="user-prompt">Prompt</label>
<textarea
id="user-prompt"
v-model="userPrompt"
></textarea>
<div class="grid grid-cols-2 gap-2">
<button class="btn-error" @click="stop">STOP</button>
<button class="btn-success" @click="run">GENERATE</button>
</div>
<h3>{{statusMessage}}</h3>
<div style="white-space: pre-wrap" v-html="currentGeneratedText"></div>
</div>
<script type="module" src="./index.js"></script>
</body>
</html>
|