Spaces:
Running
Running
Upload index.html
Browse files- index.html +115 -0
index.html
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 Image Describer - UCAS</title>
|
| 7 |
+
<style>
|
| 8 |
+
body { font-family: Arial, sans-serif; margin: 20px; background: #f5f5f5; }
|
| 9 |
+
.container { max-width: 1000px; margin: 0 auto; background: white; padding: 20px; border-radius: 10px; }
|
| 10 |
+
.status { padding: 10px; margin: 10px 0; border-radius: 5px; }
|
| 11 |
+
.running { background: #d4edda; color: #155724; }
|
| 12 |
+
.error { background: #f8d7da; color: #721c24; }
|
| 13 |
+
.video-container { position: relative; width: 640px; margin: 20px 0; }
|
| 14 |
+
#cameraFeed { width: 100%; border: 2px solid #ddd; }
|
| 15 |
+
.capture-btn { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); }
|
| 16 |
+
.controls { margin: 20px 0; display: flex; gap: 20px; flex-wrap: wrap; }
|
| 17 |
+
select, button { padding: 10px; font-size: 16px; }
|
| 18 |
+
button { background: #007bff; color: white; border: none; cursor: pointer; }
|
| 19 |
+
button:hover { background: #0056b3; }
|
| 20 |
+
.results { margin-top: 20px; padding: 20px; border: 1px solid #ddd; }
|
| 21 |
+
.result-section { margin: 20px 0; }
|
| 22 |
+
</style>
|
| 23 |
+
</head>
|
| 24 |
+
<body>
|
| 25 |
+
<div class="container">
|
| 26 |
+
<h1>Web based LLM Image Describer - UCAS @2025</h1>
|
| 27 |
+
|
| 28 |
+
<div id="status" class="status running">
|
| 29 |
+
<strong>Backend Server:</strong> Running<br>
|
| 30 |
+
<strong>Hugging Face Connection:</strong> <span id="hfStatus">Checking...</span>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<div class="controls">
|
| 34 |
+
<div>
|
| 35 |
+
<label><strong>Select Target Language:</strong></label>
|
| 36 |
+
<select id="language">
|
| 37 |
+
<option value="Chinese">Chinese</option>
|
| 38 |
+
<option value="English">English</option>
|
| 39 |
+
<option value="French">French</option>
|
| 40 |
+
<option value="Spanish">Spanish</option>
|
| 41 |
+
<option value="German">German</option>
|
| 42 |
+
</select>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<div>
|
| 46 |
+
<label><strong>Select VLM for Image Analysis:</strong></label>
|
| 47 |
+
<select id="vlmModel">
|
| 48 |
+
<option value="Salesforce/blip-image-captioning-large">BLIP-Large (Detailed Description)[citation:2]</option>
|
| 49 |
+
<option value="Salesforce/blip2-opt-2.7b">BLIP2 (VQA & Detailed)[citation:6]</option>
|
| 50 |
+
<option value="nlpconnect/vit-gpt2-image-captioning">ViT-GPT2 (Fast)</option>
|
| 51 |
+
</select>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<div>
|
| 55 |
+
<label><strong>Select Llama Model:</strong></label>
|
| 56 |
+
<select id="llamaModel">
|
| 57 |
+
<option value="meta-llama/Llama-3.1-8B-Instruct">Llama 3.1 8B Instruct[citation:5]</option>
|
| 58 |
+
<option value="meta-llama/Meta-Llama-3.1-70B-Instruct">Llama 3.1 70B (Best Quality)</option>
|
| 59 |
+
<option value="TinyLlama/TinyLlama-1.1B-Chat-v1.0">TinyLlama (Fastest)</option>
|
| 60 |
+
</select>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<div class="controls">
|
| 65 |
+
<div>
|
| 66 |
+
<strong>Image Source:</strong><br>
|
| 67 |
+
<button onclick="startCamera()">Start Camera</button>
|
| 68 |
+
<button onclick="stopCamera()">Stop Camera</button>
|
| 69 |
+
<input type="file" id="fileUpload" accept="image/*" style="display: none;">
|
| 70 |
+
<button onclick="document.getElementById('fileUpload').click()">Upload Image</button>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<div class="video-container" id="videoContainer" style="display: none;">
|
| 75 |
+
<video id="cameraFeed" autoplay playsinline></video>
|
| 76 |
+
<button class="capture-btn" onclick="captureImage()">Capture Image</button>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<div id="imagePreview" style="display: none; margin: 20px 0;">
|
| 80 |
+
<h3>Captured Image:</h3>
|
| 81 |
+
<img id="previewImage" style="max-width: 100%; max-height: 400px;">
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<button onclick="generateDescription()" style="padding: 15px 30px; font-size: 18px;">
|
| 85 |
+
Generate Description
|
| 86 |
+
</button>
|
| 87 |
+
|
| 88 |
+
<div class="results" id="results" style="display: none;">
|
| 89 |
+
<h2>Analysis Results</h2>
|
| 90 |
+
|
| 91 |
+
<div class="result-section">
|
| 92 |
+
<h3>π· Basic Image Description:</h3>
|
| 93 |
+
<div id="basicDescription">Generating...</div>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<div class="result-section">
|
| 97 |
+
<h3>π Detailed Object Analysis:</h3>
|
| 98 |
+
<div id="detailedAnalysis">Generating...</div>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<div class="result-section">
|
| 102 |
+
<h3>π Translation:</h3>
|
| 103 |
+
<div id="translation">Generating...</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<div class="result-section">
|
| 107 |
+
<h3>π JSON Output:</h3>
|
| 108 |
+
<pre id="jsonOutput"></pre>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
|
| 113 |
+
<script src="app.js"></script>
|
| 114 |
+
</body>
|
| 115 |
+
</html>
|