Arsala Grey
updated chat rendering + users can now choose response length
11f5144
raw
history blame
1.74 kB
<!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="/utils.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</h1>
<label for="hf-token">Hugging Face Token</label>
<input
id="hf-token"
v-model="token"
placeholder="HF-TOKEN"
type="password"
/>
<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>
<label for="response-length">Response Length</label>
<select id="response-length" v-model="responseLength">
<option value="short">Short</option>
<option value="medium">Medium</option>
<option value="long">Long</option>
</select>
<label for="user-prompt">Prompt</label>
<textarea
id="user-prompt"
v-model="userPrompt"
style="width: 100%; height: 100px"
></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>
<h2>Result</h2>
<div v-if="currentGeneratedText.length == 0 && isRunning">Loading...</div>
<div style="white-space: pre-wrap;" v-html="currentGeneratedText"></div>
</div>
<script type="module" src="./index.js"></script>
</body>
</html>