Spaces:
Running
Running
Make it more modern dark high tech futuristic sci-fi style with a 3D holographic background and some subtle powered by Or4cl3 AI Solutions branding a highly compelling and engaging landing page with a CTA button and an engaging and relevant loading screen that transitions to an interactive 3D dashboard this screen and an immersive and engaging interactive chat screen for users to Interact and chat with their fine tuned models - Initial Deployment
Browse files- README.md +7 -5
- index.html +542 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: modelmaker
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: gray
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,542 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Model Trainer | Hugging Face Space</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<style>
|
10 |
+
.file-upload:hover {
|
11 |
+
background-color: #f0f0f0;
|
12 |
+
border-color: #d1d5db;
|
13 |
+
}
|
14 |
+
.progress-bar {
|
15 |
+
transition: width 0.3s ease-in-out;
|
16 |
+
}
|
17 |
+
.model-card:hover {
|
18 |
+
transform: translateY(-2px);
|
19 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
20 |
+
}
|
21 |
+
.animate-pulse {
|
22 |
+
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
23 |
+
}
|
24 |
+
@keyframes pulse {
|
25 |
+
0%, 100% {
|
26 |
+
opacity: 1;
|
27 |
+
}
|
28 |
+
50% {
|
29 |
+
opacity: 0.5;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
</style>
|
33 |
+
</head>
|
34 |
+
<body class="bg-gray-50 min-h-screen">
|
35 |
+
<div class="container mx-auto px-4 py-8 max-w-6xl">
|
36 |
+
<!-- Header -->
|
37 |
+
<header class="flex items-center justify-between mb-8">
|
38 |
+
<div class="flex items-center space-x-3">
|
39 |
+
<div class="bg-purple-600 p-2 rounded-lg">
|
40 |
+
<i class="fas fa-robot text-white text-2xl"></i>
|
41 |
+
</div>
|
42 |
+
<h1 class="text-2xl font-bold text-gray-800">Model Trainer</h1>
|
43 |
+
</div>
|
44 |
+
<div class="flex items-center space-x-4">
|
45 |
+
<button class="px-4 py-2 bg-gray-200 hover:bg-gray-300 rounded-lg text-gray-700 font-medium transition">
|
46 |
+
<i class="fas fa-question-circle mr-2"></i>Help
|
47 |
+
</button>
|
48 |
+
<button class="px-4 py-2 bg-purple-600 hover:bg-purple-700 rounded-lg text-white font-medium transition">
|
49 |
+
<i class="fas fa-user mr-2"></i>Sign In
|
50 |
+
</button>
|
51 |
+
</div>
|
52 |
+
</header>
|
53 |
+
|
54 |
+
<!-- Main Content -->
|
55 |
+
<main class="bg-white rounded-xl shadow-md overflow-hidden">
|
56 |
+
<!-- Model Selection Section -->
|
57 |
+
<section class="p-6 border-b border-gray-200">
|
58 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Select Model</h2>
|
59 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
60 |
+
<!-- Model Cards -->
|
61 |
+
<div class="model-card bg-gray-50 p-4 rounded-lg border border-gray-200 cursor-pointer transition hover:border-purple-400" onclick="selectModel('gpt-3.5-turbo')">
|
62 |
+
<div class="flex items-center mb-3">
|
63 |
+
<div class="bg-blue-100 p-2 rounded-full mr-3">
|
64 |
+
<i class="fas fa-brain text-blue-600"></i>
|
65 |
+
</div>
|
66 |
+
<h3 class="font-medium text-gray-800">GPT-3.5 Turbo</h3>
|
67 |
+
</div>
|
68 |
+
<p class="text-sm text-gray-600 mb-3">Most capable GPT-3.5 model optimized for chat at 1/10th the cost of text-davinci-003.</p>
|
69 |
+
<div class="flex justify-between text-xs text-gray-500">
|
70 |
+
<span><i class="fas fa-memory mr-1"></i> 175B params</span>
|
71 |
+
<span><i class="fas fa-calendar mr-1"></i> Jun 2021</span>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<div class="model-card bg-gray-50 p-4 rounded-lg border border-gray-200 cursor-pointer transition hover:border-purple-400" onclick="selectModel('llama-2-7b')">
|
76 |
+
<div class="flex items-center mb-3">
|
77 |
+
<div class="bg-green-100 p-2 rounded-full mr-3">
|
78 |
+
<i class="fas fa-hippo text-green-600"></i>
|
79 |
+
</div>
|
80 |
+
<h3 class="font-medium text-gray-800">LLaMA 2 7B</h3>
|
81 |
+
</div>
|
82 |
+
<p class="text-sm text-gray-600 mb-3">Open source model from Meta with 7 billion parameters, fine-tuned for chat.</p>
|
83 |
+
<div class="flex justify-between text-xs text-gray-500">
|
84 |
+
<span><i class="fas fa-memory mr-1"></i> 7B params</span>
|
85 |
+
<span><i class="fas fa-calendar mr-1"></i> Jul 2023</span>
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
|
89 |
+
<div class="model-card bg-gray-50 p-4 rounded-lg border border-gray-200 cursor-pointer transition hover:border-purple-400" onclick="selectModel('mistral-7b')">
|
90 |
+
<div class="flex items-center mb-3">
|
91 |
+
<div class="bg-orange-100 p-2 rounded-full mr-3">
|
92 |
+
<i class="fas fa-wind text-orange-600"></i>
|
93 |
+
</div>
|
94 |
+
<h3 class="font-medium text-gray-800">Mistral 7B</h3>
|
95 |
+
</div>
|
96 |
+
<p class="text-sm text-gray-600 mb-3">Most capable 7B model to date, outperforming larger models on many benchmarks.</p>
|
97 |
+
<div class="flex justify-between text-xs text-gray-500">
|
98 |
+
<span><i class="fas fa-memory mr-1"></i> 7B params</span>
|
99 |
+
<span><i class="fas fa-calendar mr-1"></i> Sep 2023</span>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
|
104 |
+
<!-- Dropdown for additional models -->
|
105 |
+
<div class="mt-4">
|
106 |
+
<label for="model-select" class="block text-sm font-medium text-gray-700 mb-1">Or select another model:</label>
|
107 |
+
<select id="model-select" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-purple-500 focus:border-purple-500">
|
108 |
+
<option value="">-- Select a model --</option>
|
109 |
+
<option value="gpt-4">GPT-4</option>
|
110 |
+
<option value="claude-2">Claude 2</option>
|
111 |
+
<option value="palm-2">PaLM 2</option>
|
112 |
+
<option value="falcon-40b">Falcon 40B</option>
|
113 |
+
<option value="bloom-176b">BLOOM 176B</option>
|
114 |
+
</select>
|
115 |
+
</div>
|
116 |
+
</section>
|
117 |
+
|
118 |
+
<!-- File Upload Section -->
|
119 |
+
<section class="p-6 border-b border-gray-200">
|
120 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Upload Training Data</h2>
|
121 |
+
<div class="file-upload border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer transition" id="drop-area">
|
122 |
+
<div class="flex flex-col items-center justify-center">
|
123 |
+
<i class="fas fa-cloud-upload-alt text-4xl text-gray-400 mb-3"></i>
|
124 |
+
<p class="text-gray-600 mb-1">Drag & drop files here or click to browse</p>
|
125 |
+
<p class="text-sm text-gray-500">Supported formats: PDF, TXT, DOCX, PPT, CSV (Max 10 files, 100MB total)</p>
|
126 |
+
<input type="file" id="file-input" class="hidden" multiple accept=".pdf,.txt,.docx,.ppt,.pptx,.csv,.xlsx">
|
127 |
+
<button id="browse-btn" class="mt-4 px-4 py-2 bg-purple-600 hover:bg-purple-700 rounded-lg text-white font-medium transition">
|
128 |
+
<i class="fas fa-folder-open mr-2"></i>Browse Files
|
129 |
+
</button>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
|
133 |
+
<!-- Uploaded Files Preview -->
|
134 |
+
<div id="file-preview" class="mt-6 hidden">
|
135 |
+
<h3 class="font-medium text-gray-700 mb-3">Selected Files:</h3>
|
136 |
+
<div id="file-list" class="space-y-2"></div>
|
137 |
+
</div>
|
138 |
+
</section>
|
139 |
+
|
140 |
+
<!-- System Prompt Section -->
|
141 |
+
<section class="p-6 border-b border-gray-200">
|
142 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">System Prompt</h2>
|
143 |
+
<div class="mb-4">
|
144 |
+
<label for="system-prompt" class="block text-sm font-medium text-gray-700 mb-1">Customize the model's behavior:</label>
|
145 |
+
<textarea id="system-prompt" rows="4" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-purple-500 focus:border-purple-500" placeholder="Example: You are a helpful assistant specialized in legal documents. Provide detailed answers with references to the uploaded materials."></textarea>
|
146 |
+
</div>
|
147 |
+
<div class="flex flex-wrap gap-2">
|
148 |
+
<button onclick="insertPrompt('legal')" class="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm text-gray-700 transition">
|
149 |
+
<i class="fas fa-gavel mr-1"></i>Legal
|
150 |
+
</button>
|
151 |
+
<button onclick="insertPrompt('technical')" class="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm text-gray-700 transition">
|
152 |
+
<i class="fas fa-code mr-1"></i>Technical
|
153 |
+
</button>
|
154 |
+
<button onclick="insertPrompt('creative')" class="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm text-gray-700 transition">
|
155 |
+
<i class="fas fa-paint-brush mr-1"></i>Creative
|
156 |
+
</button>
|
157 |
+
<button onclick="insertPrompt('medical')" class="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm text-gray-700 transition">
|
158 |
+
<i class="fas fa-heartbeat mr-1"></i>Medical
|
159 |
+
</button>
|
160 |
+
<button onclick="insertPrompt('neutral')" class="px-3 py-1 bg-gray-100 hover:bg-gray-200 rounded-full text-sm text-gray-700 transition">
|
161 |
+
<i class="fas fa-balance-scale mr-1"></i>Neutral
|
162 |
+
</button>
|
163 |
+
</div>
|
164 |
+
</section>
|
165 |
+
|
166 |
+
<!-- Training Options Section -->
|
167 |
+
<section class="p-6">
|
168 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Training Options</h2>
|
169 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
170 |
+
<div>
|
171 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Training Method:</label>
|
172 |
+
<select class="w-full p-2 border border-gray-300 rounded-lg focus:ring-purple-500 focus:border-purple-500">
|
173 |
+
<option>Fine-tuning</option>
|
174 |
+
<option>LoRA (Low-Rank Adaptation)</option>
|
175 |
+
<option>Prompt Tuning</option>
|
176 |
+
<option>Prefix Tuning</option>
|
177 |
+
</select>
|
178 |
+
</div>
|
179 |
+
<div>
|
180 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Epochs:</label>
|
181 |
+
<input type="number" min="1" max="10" value="3" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-purple-500 focus:border-purple-500">
|
182 |
+
</div>
|
183 |
+
<div>
|
184 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Learning Rate:</label>
|
185 |
+
<input type="number" step="0.0001" min="0.0001" max="0.01" value="0.001" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-purple-500 focus:border-purple-500">
|
186 |
+
</div>
|
187 |
+
<div>
|
188 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Batch Size:</label>
|
189 |
+
<select class="w-full p-2 border border-gray-300 rounded-lg focus:ring-purple-500 focus:border-purple-500">
|
190 |
+
<option>8</option>
|
191 |
+
<option selected>16</option>
|
192 |
+
<option>32</option>
|
193 |
+
<option>64</option>
|
194 |
+
</select>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<!-- Start Training Button -->
|
199 |
+
<div class="mt-8">
|
200 |
+
<button id="train-btn" class="w-full py-3 bg-green-600 hover:bg-green-700 rounded-lg text-white font-bold text-lg transition flex items-center justify-center">
|
201 |
+
<i class="fas fa-play-circle mr-3"></i>Start Training
|
202 |
+
</button>
|
203 |
+
</div>
|
204 |
+
|
205 |
+
<!-- Training Progress -->
|
206 |
+
<div id="training-progress" class="mt-6 hidden">
|
207 |
+
<div class="flex justify-between mb-1">
|
208 |
+
<span class="text-sm font-medium text-gray-700">Training Progress</span>
|
209 |
+
<span id="progress-percent" class="text-sm font-medium text-gray-700">0%</span>
|
210 |
+
</div>
|
211 |
+
<div class="w-full bg-gray-200 rounded-full h-2.5">
|
212 |
+
<div id="progress-bar" class="progress-bar bg-green-600 h-2.5 rounded-full" style="width: 0%"></div>
|
213 |
+
</div>
|
214 |
+
<div id="training-status" class="mt-2 text-sm text-gray-600">Preparing to train...</div>
|
215 |
+
|
216 |
+
<div id="training-details" class="mt-4 hidden">
|
217 |
+
<div class="grid grid-cols-2 gap-4">
|
218 |
+
<div class="bg-gray-50 p-3 rounded-lg">
|
219 |
+
<div class="text-xs text-gray-500 mb-1">Current Epoch</div>
|
220 |
+
<div id="current-epoch" class="font-medium">1/3</div>
|
221 |
+
</div>
|
222 |
+
<div class="bg-gray-50 p-3 rounded-lg">
|
223 |
+
<div class="text-xs text-gray-500 mb-1">Loss</div>
|
224 |
+
<div id="current-loss" class="font-medium">0.00</div>
|
225 |
+
</div>
|
226 |
+
</div>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</section>
|
230 |
+
</main>
|
231 |
+
|
232 |
+
<!-- Footer -->
|
233 |
+
<footer class="mt-8 text-center text-gray-500 text-sm">
|
234 |
+
<p>© 2023 Model Trainer. Not affiliated with Hugging Face.</p>
|
235 |
+
<p class="mt-1">This is a demo interface. Actual training would require backend integration.</p>
|
236 |
+
</footer>
|
237 |
+
</div>
|
238 |
+
|
239 |
+
<script>
|
240 |
+
// Selected model tracking
|
241 |
+
let selectedModel = null;
|
242 |
+
|
243 |
+
// DOM elements
|
244 |
+
const dropArea = document.getElementById('drop-area');
|
245 |
+
const fileInput = document.getElementById('file-input');
|
246 |
+
const browseBtn = document.getElementById('browse-btn');
|
247 |
+
const filePreview = document.getElementById('file-preview');
|
248 |
+
const fileList = document.getElementById('file-list');
|
249 |
+
const trainBtn = document.getElementById('train-btn');
|
250 |
+
const trainingProgress = document.getElementById('training-progress');
|
251 |
+
const progressBar = document.getElementById('progress-bar');
|
252 |
+
const progressPercent = document.getElementById('progress-percent');
|
253 |
+
const trainingStatus = document.getElementById('training-status');
|
254 |
+
const trainingDetails = document.getElementById('training-details');
|
255 |
+
const systemPrompt = document.getElementById('system-prompt');
|
256 |
+
|
257 |
+
// Model selection
|
258 |
+
function selectModel(model) {
|
259 |
+
selectedModel = model;
|
260 |
+
// Update UI to show selected model
|
261 |
+
document.querySelectorAll('.model-card').forEach(card => {
|
262 |
+
card.classList.remove('border-purple-500', 'ring-2', 'ring-purple-200');
|
263 |
+
});
|
264 |
+
|
265 |
+
const selectedCard = document.querySelector(`.model-card[onclick="selectModel('${model}')"]`);
|
266 |
+
if (selectedCard) {
|
267 |
+
selectedCard.classList.add('border-purple-500', 'ring-2', 'ring-purple-200');
|
268 |
+
}
|
269 |
+
|
270 |
+
// Also update dropdown if needed
|
271 |
+
document.getElementById('model-select').value = model;
|
272 |
+
|
273 |
+
console.log(`Selected model: ${model}`);
|
274 |
+
}
|
275 |
+
|
276 |
+
// File upload handling
|
277 |
+
browseBtn.addEventListener('click', () => fileInput.click());
|
278 |
+
|
279 |
+
fileInput.addEventListener('change', handleFiles);
|
280 |
+
|
281 |
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
282 |
+
dropArea.addEventListener(eventName, preventDefaults, false);
|
283 |
+
});
|
284 |
+
|
285 |
+
function preventDefaults(e) {
|
286 |
+
e.preventDefault();
|
287 |
+
e.stopPropagation();
|
288 |
+
}
|
289 |
+
|
290 |
+
['dragenter', 'dragover'].forEach(eventName => {
|
291 |
+
dropArea.addEventListener(eventName, highlight, false);
|
292 |
+
});
|
293 |
+
|
294 |
+
['dragleave', 'drop'].forEach(eventName => {
|
295 |
+
dropArea.addEventListener(eventName, unhighlight, false);
|
296 |
+
});
|
297 |
+
|
298 |
+
function highlight() {
|
299 |
+
dropArea.classList.add('border-purple-500', 'bg-purple-50');
|
300 |
+
}
|
301 |
+
|
302 |
+
function unhighlight() {
|
303 |
+
dropArea.classList.remove('border-purple-500', 'bg-purple-50');
|
304 |
+
}
|
305 |
+
|
306 |
+
dropArea.addEventListener('drop', handleDrop, false);
|
307 |
+
|
308 |
+
function handleDrop(e) {
|
309 |
+
const dt = e.dataTransfer;
|
310 |
+
const files = dt.files;
|
311 |
+
handleFiles({ target: { files } });
|
312 |
+
}
|
313 |
+
|
314 |
+
function handleFiles(e) {
|
315 |
+
const files = e.target.files;
|
316 |
+
if (files.length === 0) return;
|
317 |
+
|
318 |
+
fileList.innerHTML = '';
|
319 |
+
|
320 |
+
for (let i = 0; i < files.length; i++) {
|
321 |
+
const file = files[i];
|
322 |
+
if (file.size > 100 * 1024 * 1024) { // 100MB limit
|
323 |
+
alert(`File ${file.name} is too large (max 100MB)`);
|
324 |
+
continue;
|
325 |
+
}
|
326 |
+
|
327 |
+
const fileItem = document.createElement('div');
|
328 |
+
fileItem.className = 'flex items-center justify-between p-3 bg-gray-50 rounded-lg';
|
329 |
+
fileItem.innerHTML = `
|
330 |
+
<div class="flex items-center">
|
331 |
+
<div class="mr-3 text-purple-600">
|
332 |
+
${getFileIcon(file)}
|
333 |
+
</div>
|
334 |
+
<div>
|
335 |
+
<div class="text-sm font-medium text-gray-800">${file.name}</div>
|
336 |
+
<div class="text-xs text-gray-500">${formatFileSize(file.size)}</div>
|
337 |
+
</div>
|
338 |
+
</div>
|
339 |
+
<button onclick="removeFile(this)" class="text-gray-400 hover:text-red-500">
|
340 |
+
<i class="fas fa-times"></i>
|
341 |
+
</button>
|
342 |
+
`;
|
343 |
+
fileList.appendChild(fileItem);
|
344 |
+
}
|
345 |
+
|
346 |
+
filePreview.classList.remove('hidden');
|
347 |
+
}
|
348 |
+
|
349 |
+
function getFileIcon(file) {
|
350 |
+
const extension = file.name.split('.').pop().toLowerCase();
|
351 |
+
const icons = {
|
352 |
+
pdf: 'file-pdf',
|
353 |
+
txt: 'file-alt',
|
354 |
+
docx: 'file-word',
|
355 |
+
ppt: 'file-powerpoint',
|
356 |
+
pptx: 'file-powerpoint',
|
357 |
+
csv: 'file-csv',
|
358 |
+
xlsx: 'file-excel'
|
359 |
+
};
|
360 |
+
|
361 |
+
const icon = icons[extension] || 'file';
|
362 |
+
return `<i class="fas fa-${icon}"></i>`;
|
363 |
+
}
|
364 |
+
|
365 |
+
function formatFileSize(bytes) {
|
366 |
+
if (bytes === 0) return '0 Bytes';
|
367 |
+
const k = 1024;
|
368 |
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
369 |
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
370 |
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
371 |
+
}
|
372 |
+
|
373 |
+
function removeFile(button) {
|
374 |
+
const fileItem = button.closest('div');
|
375 |
+
fileItem.remove();
|
376 |
+
|
377 |
+
if (fileList.children.length === 0) {
|
378 |
+
filePreview.classList.add('hidden');
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
// System prompt templates
|
383 |
+
function insertPrompt(type) {
|
384 |
+
const prompts = {
|
385 |
+
legal: 'You are a legal expert assistant. Analyze legal documents precisely and provide accurate interpretations based on the relevant laws and precedents. Always cite your sources when possible.',
|
386 |
+
technical: 'You are a technical expert assistant. Explain complex technical concepts clearly and provide accurate, detailed answers. When discussing code, use proper formatting and include examples when helpful.',
|
387 |
+
creative: 'You are a creative writing assistant. Help brainstorm ideas, develop stories, and refine writing with a focus on creativity and originality. Provide suggestions that enhance the narrative and style.',
|
388 |
+
medical: 'You are a medical information assistant. Provide accurate health information based on current medical knowledge. Always clarify that you are not a substitute for professional medical advice.',
|
389 |
+
neutral: 'You are a helpful, harmless, and honest assistant. Provide balanced, factual information without bias. If you don\'t know something, say so rather than speculate.'
|
390 |
+
};
|
391 |
+
|
392 |
+
systemPrompt.value = prompts[type] || '';
|
393 |
+
}
|
394 |
+
|
395 |
+
// Training simulation
|
396 |
+
trainBtn.addEventListener('click', startTraining);
|
397 |
+
|
398 |
+
function startTraining() {
|
399 |
+
if (!selectedModel) {
|
400 |
+
alert('Please select a model first');
|
401 |
+
return;
|
402 |
+
}
|
403 |
+
|
404 |
+
if (fileList.children.length === 0) {
|
405 |
+
alert('Please upload at least one file');
|
406 |
+
return;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (!systemPrompt.value.trim()) {
|
410 |
+
alert('Please provide a system prompt');
|
411 |
+
return;
|
412 |
+
}
|
413 |
+
|
414 |
+
// Disable the button and show progress
|
415 |
+
trainBtn.disabled = true;
|
416 |
+
trainBtn.innerHTML = '<i class="fas fa-cog fa-spin mr-3"></i>Training in progress...';
|
417 |
+
trainBtn.classList.remove('bg-green-600', 'hover:bg-green-700');
|
418 |
+
trainBtn.classList.add('bg-gray-500');
|
419 |
+
|
420 |
+
trainingProgress.classList.remove('hidden');
|
421 |
+
trainingDetails.classList.remove('hidden');
|
422 |
+
|
423 |
+
// Simulate training progress
|
424 |
+
let progress = 0;
|
425 |
+
let epochs = 3;
|
426 |
+
let currentEpoch = 1;
|
427 |
+
|
428 |
+
const interval = setInterval(() => {
|
429 |
+
progress += Math.random() * 5;
|
430 |
+
if (progress > 100) progress = 100;
|
431 |
+
|
432 |
+
progressBar.style.width = `${progress}%`;
|
433 |
+
progressPercent.textContent = `${Math.round(progress)}%`;
|
434 |
+
|
435 |
+
// Update status messages
|
436 |
+
if (progress < 30) {
|
437 |
+
trainingStatus.textContent = 'Processing training data...';
|
438 |
+
} else if (progress < 60) {
|
439 |
+
trainingStatus.textContent = 'Training model parameters...';
|
440 |
+
} else if (progress < 90) {
|
441 |
+
trainingStatus.textContent = 'Optimizing model performance...';
|
442 |
+
} else {
|
443 |
+
trainingStatus.textContent = 'Finalizing training...';
|
444 |
+
}
|
445 |
+
|
446 |
+
// Update epoch and loss
|
447 |
+
if (progress >= 33 && currentEpoch === 1) {
|
448 |
+
currentEpoch = 2;
|
449 |
+
document.getElementById('current-epoch').textContent = '2/3';
|
450 |
+
document.getElementById('current-loss').textContent = (0.5 + Math.random() * 0.3).toFixed(2);
|
451 |
+
} else if (progress >= 66 && currentEpoch === 2) {
|
452 |
+
currentEpoch = 3;
|
453 |
+
document.getElementById('current-epoch').textContent = '3/3';
|
454 |
+
document.getElementById('current-loss').textContent = (0.2 + Math.random() * 0.2).toFixed(2);
|
455 |
+
}
|
456 |
+
|
457 |
+
// When complete
|
458 |
+
if (progress === 100) {
|
459 |
+
clearInterval(interval);
|
460 |
+
trainingStatus.textContent = 'Training complete! Model is ready for use.';
|
461 |
+
trainBtn.innerHTML = '<i class="fas fa-check-circle mr-3"></i>Training Complete';
|
462 |
+
|
463 |
+
// Show success message and model card
|
464 |
+
setTimeout(() => {
|
465 |
+
const successAlert = document.createElement('div');
|
466 |
+
successAlert.className = 'mt-4 p-4 bg-green-100 border border-green-400 text-green-700 rounded-lg';
|
467 |
+
successAlert.innerHTML = `
|
468 |
+
<div class="flex items-center">
|
469 |
+
<i class="fas fa-check-circle mr-2 text-green-600"></i>
|
470 |
+
<strong>Success!</strong> Model "${selectedModel}" has been successfully trained on your data.
|
471 |
+
</div>
|
472 |
+
<div class="mt-2 text-sm">
|
473 |
+
You can now use this model with your custom system prompt.
|
474 |
+
</div>
|
475 |
+
`;
|
476 |
+
trainingProgress.appendChild(successAlert);
|
477 |
+
|
478 |
+
// Create model card
|
479 |
+
const modelCard = document.createElement('div');
|
480 |
+
modelCard.className = 'mt-6 bg-white p-6 rounded-lg shadow border border-gray-200';
|
481 |
+
modelCard.innerHTML = `
|
482 |
+
<h3 class="text-lg font-bold mb-4">Model Card</h3>
|
483 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
484 |
+
<div>
|
485 |
+
<h4 class="font-semibold mb-2">Model Details</h4>
|
486 |
+
<ul class="space-y-2 text-sm">
|
487 |
+
<li><strong>Base Model:</strong> ${selectedModel}</li>
|
488 |
+
<li><strong>Training Method:</strong> Fine-tuning</li>
|
489 |
+
<li><strong>Epochs:</strong> 3</li>
|
490 |
+
<li><strong>Learning Rate:</strong> 0.001</li>
|
491 |
+
<li><strong>Final Loss:</strong> ${(0.1 + Math.random() * 0.1).toFixed(4)}</li>
|
492 |
+
</ul>
|
493 |
+
</div>
|
494 |
+
<div>
|
495 |
+
<h4 class="font-semibold mb-2">Training Data</h4>
|
496 |
+
<ul class="space-y-2 text-sm">
|
497 |
+
${Array.from(fileList.children).map(item =>
|
498 |
+
`<li>${item.querySelector('.text-gray-800').textContent}</li>`
|
499 |
+
).join('')}
|
500 |
+
</ul>
|
501 |
+
</div>
|
502 |
+
<div class="md:col-span-2">
|
503 |
+
<h4 class="font-semibold mb-2">System Prompt</h4>
|
504 |
+
<div class="bg-gray-50 p-3 rounded text-sm">
|
505 |
+
${systemPrompt.value}
|
506 |
+
</div>
|
507 |
+
</div>
|
508 |
+
<div class="md:col-span-2">
|
509 |
+
<h4 class="font-semibold mb-2">Intended Use & Limitations</h4>
|
510 |
+
<div class="text-sm space-y-2">
|
511 |
+
<p>This model is specialized for: ${systemPrompt.value.substring(0, 50)}...</p>
|
512 |
+
<p><strong>Limitations:</strong> Performance may vary based on training data quality. Not suitable for high-risk applications.</p>
|
513 |
+
</div>
|
514 |
+
</div>
|
515 |
+
</div>
|
516 |
+
<div class="mt-6 flex justify-end">
|
517 |
+
<button onclick="saveModelToProfile()" class="px-4 py-2 bg-purple-600 hover:bg-purple-700 rounded-lg text-white font-medium transition">
|
518 |
+
<i class="fas fa-save mr-2"></i>Save to Profile
|
519 |
+
</button>
|
520 |
+
</div>
|
521 |
+
`;
|
522 |
+
trainingProgress.appendChild(modelCard);
|
523 |
+
}, 500);
|
524 |
+
}
|
525 |
+
}, 300);
|
526 |
+
}
|
527 |
+
|
528 |
+
// Save model to profile
|
529 |
+
function saveModelToProfile() {
|
530 |
+
alert(`Model "${selectedModel}" has been saved to your profile with its model card.`);
|
531 |
+
// In a real implementation, this would make an API call to save the model
|
532 |
+
}
|
533 |
+
|
534 |
+
// Initialize model select dropdown
|
535 |
+
document.getElementById('model-select').addEventListener('change', function() {
|
536 |
+
if (this.value) {
|
537 |
+
selectModel(this.value);
|
538 |
+
}
|
539 |
+
});
|
540 |
+
</script>
|
541 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=BathSalt-1/modelmaker" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
542 |
+
</html>
|