ai / index.html
safeer-ch's picture
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("deepseek-ai/Janus-Pro-7B") - Initial Deployment
6c13e1f verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Model Loading Interface</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.gradient-bg {
background: linear-gradient(135deg, #6e8efb, #a777e3);
}
.model-card {
transition: all 0.3s ease;
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.model-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}
.progress-bar {
transition: width 0.5s ease;
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
</style>
</head>
<body class="gradient-bg min-h-screen flex items-center justify-center p-4">
<div class="w-full max-w-4xl bg-white rounded-xl overflow-hidden shadow-2xl">
<!-- Header -->
<div class="bg-indigo-700 text-white p-6">
<div class="flex items-center justify-between">
<div>
<h1 class="text-2xl font-bold">Janus-Pro-7B Model Loader</h1>
<p class="text-indigo-200">Load deep learning models from Hugging Face</p>
</div>
<div class="bg-indigo-600 p-3 rounded-lg">
<i class="fas fa-brain text-2xl"></i>
</div>
</div>
</div>
<!-- Main Content -->
<div class="p-6">
<!-- Model Info -->
<div class="model-card bg-gray-50 rounded-lg p-6 mb-6 border border-gray-200">
<div class="flex flex-col md:flex-row gap-6">
<div class="flex-shrink-0">
<div class="bg-indigo-100 w-20 h-20 rounded-full flex items-center justify-center">
<i class="fas fa-robot text-indigo-600 text-3xl"></i>
</div>
</div>
<div class="flex-grow">
<h2 class="text-xl font-semibold text-gray-800">deepseek-ai/Janus-Pro-7B</h2>
<p class="text-gray-600 mt-2">A powerful 7 billion parameter model developed by DeepSeek AI for advanced natural language processing tasks.</p>
<div class="mt-4 flex flex-wrap gap-2">
<span class="bg-indigo-100 text-indigo-800 text-xs px-3 py-1 rounded-full">7B Parameters</span>
<span class="bg-purple-100 text-purple-800 text-xs px-3 py-1 rounded-full">Transformer</span>
<span class="bg-green-100 text-green-800 text-xs px-3 py-1 rounded-full">NLP</span>
</div>
</div>
</div>
</div>
<!-- Loading Controls -->
<div class="bg-white rounded-lg p-6 border border-gray-200 mb-6">
<h3 class="text-lg font-medium text-gray-800 mb-4">Load Model Configuration</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Model Repository</label>
<div class="flex">
<span class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 bg-gray-50 text-gray-500 text-sm">
<i class="fas fa-database mr-2"></i> Hugging Face
</span>
<input type="text" id="model-repo" value="deepseek-ai/Janus-Pro-7B"
class="flex-1 min-w-0 block w-full px-3 py-2 rounded-none rounded-r-md border border-gray-300 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Precision</label>
<select class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md border">
<option>float32 (default)</option>
<option>float16</option>
<option>bfloat16</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Device</label>
<select class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md border">
<option>Auto-detect</option>
<option>CPU</option>
<option>CUDA</option>
<option>MPS (Apple Silicon)</option>
</select>
</div>
</div>
<div class="flex items-center">
<input id="cache-model" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" checked>
<label for="cache-model" class="ml-2 block text-sm text-gray-700">Cache model locally</label>
</div>
</div>
</div>
<!-- Loading Progress -->
<div id="loading-section" class="hidden">
<div class="bg-white rounded-lg p-6 border border-gray-200 mb-6">
<h3 class="text-lg font-medium text-gray-800 mb-4">Loading Progress</h3>
<div class="space-y-4">
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Downloading model</span>
<span id="download-percent" class="text-sm font-medium text-gray-700">0%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div id="download-progress" class="progress-bar bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
</div>
</div>
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Initializing model</span>
<span id="init-percent" class="text-sm font-medium text-gray-700">Waiting...</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2.5">
<div id="init-progress" class="progress-bar bg-purple-600 h-2.5 rounded-full" style="width: 0%"></div>
</div>
</div>
<div id="success-message" class="hidden mt-6 p-4 bg-green-50 border border-green-200 rounded-lg">
<div class="flex items-center">
<div class="flex-shrink-0">
<i class="fas fa-check-circle text-green-500 text-2xl"></i>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-green-800">Model loaded successfully!</h3>
<div class="mt-2 text-sm text-green-700">
<p>Janus-Pro-7B is now ready for inference.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Action Buttons -->
<div class="flex flex-col sm:flex-row justify-end gap-3">
<button id="cancel-btn" class="hidden px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Cancel Loading
</button>
<button id="load-btn" class="px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 flex items-center justify-center">
<i class="fas fa-download mr-2"></i> Load Model
</button>
</div>
</div>
<!-- Status Bar -->
<div class="bg-gray-100 px-6 py-3 border-t border-gray-200">
<div class="flex items-center">
<div id="status-icon" class="h-3 w-3 rounded-full bg-gray-400 mr-2"></div>
<span id="status-text" class="text-sm text-gray-600">Ready to load model</span>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const loadBtn = document.getElementById('load-btn');
const cancelBtn = document.getElementById('cancel-btn');
const loadingSection = document.getElementById('loading-section');
const downloadProgress = document.getElementById('download-progress');
const downloadPercent = document.getElementById('download-percent');
const initProgress = document.getElementById('init-progress');
const initPercent = document.getElementById('init-percent');
const successMessage = document.getElementById('success-message');
const statusIcon = document.getElementById('status-icon');
const statusText = document.getElementById('status-text');
let loadingInterval;
let loading = false;
loadBtn.addEventListener('click', function() {
if (loading) return;
// Show loading section
loadingSection.classList.remove('hidden');
loadBtn.classList.add('hidden');
cancelBtn.classList.remove('hidden');
// Update status
statusIcon.classList.remove('bg-gray-400');
statusIcon.classList.add('bg-yellow-400', 'pulse');
statusText.textContent = 'Downloading model...';
// Simulate download progress
let progress = 0;
loadingInterval = setInterval(function() {
progress += Math.random() * 10;
if (progress > 100) progress = 100;
downloadProgress.style.width = progress + '%';
downloadPercent.textContent = Math.round(progress) + '%';
if (progress === 100) {
clearInterval(loadingInterval);
startInitialization();
}
}, 500);
loading = true;
});
function startInitialization() {
statusText.textContent = 'Initializing model...';
statusIcon.classList.remove('bg-yellow-400');
statusIcon.classList.add('bg-blue-400', 'pulse');
let initProgressValue = 0;
loadingInterval = setInterval(function() {
initProgressValue += Math.random() * 15;
if (initProgressValue > 100) {
initProgressValue = 100;
completeLoading();
clearInterval(loadingInterval);
}
initProgress.style.width = initProgressValue + '%';
initPercent.textContent = initProgressValue === 100 ? 'Complete' : Math.round(initProgressValue) + '%';
}, 300);
}
function completeLoading() {
statusIcon.classList.remove('bg-blue-400', 'pulse');
statusIcon.classList.add('bg-green-500');
statusText.textContent = 'Model ready for inference';
successMessage.classList.remove('hidden');
cancelBtn.classList.add('hidden');
// Change load button to "Load Another Model"
loadBtn.classList.remove('hidden');
loadBtn.innerHTML = '<i class="fas fa-sync-alt mr-2"></i> Load Another Model';
loading = false;
}
cancelBtn.addEventListener('click', function() {
clearInterval(loadingInterval);
loadingSection.classList.add('hidden');
loadBtn.classList.remove('hidden');
cancelBtn.classList.add('hidden');
// Reset progress bars
downloadProgress.style.width = '0%';
downloadPercent.textContent = '0%';
initProgress.style.width = '0%';
initPercent.textContent = 'Waiting...';
// Reset status
statusIcon.classList.remove('bg-yellow-400', 'bg-blue-400', 'pulse');
statusIcon.classList.add('bg-gray-400');
statusText.textContent = 'Ready to load model';
loading = false;
});
});
</script>
<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=safeer-ch/ai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>