|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="utf-8" /> |
|
<meta name="viewport" content="width=device-width" /> |
|
<title>Image Object Detection Vue - HuggingFace.js Live Examples</title> |
|
<link rel="stylesheet" href="pico.classless.min.css" /> |
|
<link rel="stylesheet" href="main.css" /> |
|
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> |
|
</head> |
|
<body> |
|
<div id="generate-text-stream-app" class="container"> |
|
<h1>Classifying Random Unsplash Images</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"> |
|
<button class="btn-info" @click="shuffle">RANDOM IMAGE</button> |
|
<button class="btn-success" @click="run">CLASSIFY</button> |
|
</div> |
|
<h2>{{statusMessage}}</h2> |
|
<div class="flex justify-between"> |
|
<div v-for="classificationLabel in classificationLabels" :key="classificationLabel.label"> |
|
<h4>{{classificationLabel.label}}</h4> |
|
<p>{{Math.floor(classificationLabel.score * 100, 2)}}%</p> |
|
</div> |
|
</div> |
|
<div class="image-container"> |
|
<div id="image-wrapper"> |
|
<img :src="imageUrl" id="current-image" /> |
|
</div> |
|
</div> |
|
</div> |
|
<script type="module" src="./index.js"></script> |
|
</body> |
|
</html> |
|
|