srikarp's picture
Upload 3 files
91a9fee verified
Raw
History Blame Contribute Delete
12.8 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemma Code LLM Playground</title>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<!-- PrismJS Dark Theme for syntax highlighting -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
<!-- Main Style Sheet -->
<link rel="stylesheet" href="/static/style.css">
</head>
<body class="dark-theme">
<div class="app-container">
<!-- Top Navigation Bar -->
<header class="app-header">
<div class="header-logo">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="logo-icon">
<path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
<path d="M2 17L12 22L22 17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 12L12 17L22 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
<div class="logo-text">
<h1>Gemma Code <span>LLM</span></h1>
<span class="subtext">Finetuned Assistant</span>
</div>
</div>
<div class="header-status">
<div class="status-badge" id="statusBadge">
<span class="status-dot animate-pulse"></span>
<span class="status-text">Checking status...</span>
</div>
<button class="theme-toggle" id="themeToggleBtn" aria-label="Toggle Theme">
<!-- Light Mode Icon -->
<svg class="sun-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
<!-- Dark Mode Icon -->
<svg class="moon-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
</button>
</div>
</header>
<!-- Main Body -->
<div class="workspace">
<!-- Sidebar Panel: Controls & History -->
<aside class="sidebar">
<!-- Parameters section -->
<div class="sidebar-section">
<div class="section-header">
<h2>Parameters</h2>
</div>
<div class="parameters-form">
<div class="form-group">
<div class="label-wrapper">
<label for="temperature">Temperature</label>
<span class="val-display" id="tempVal">0.2</span>
</div>
<input type="range" id="temperature" min="0" max="2" step="0.1" value="0.2">
<span class="range-description">Lower values are more deterministic, higher are more creative.</span>
</div>
<div class="form-group">
<div class="label-wrapper">
<label for="top_p">Top-P (Nucleus)</label>
<span class="val-display" id="topPVal">0.95</span>
</div>
<input type="range" id="top_p" min="0.01" max="1" step="0.01" value="0.95">
<span class="range-description">Controls diversity via cumulative probability threshold.</span>
</div>
<div class="form-group">
<div class="label-wrapper">
<label for="max_new_tokens">Max New Tokens</label>
<span class="val-display" id="maxTokensVal">512</span>
</div>
<input type="range" id="max_new_tokens" min="32" max="2048" step="32" value="512">
</div>
<div class="form-group toggle-group">
<div class="toggle-wrapper">
<label for="safety">Safety Check</label>
<div class="switch">
<input type="checkbox" id="safety" checked>
<span class="slider round"></span>
</div>
</div>
<span class="range-description">Block unsafe requests or generated commands.</span>
</div>
</div>
</div>
<!-- History section -->
<div class="sidebar-section history-section">
<div class="section-header">
<h2>Prompt History</h2>
<button class="clear-history-btn" id="clearHistoryBtn" title="Clear History">Clear</button>
</div>
<div class="history-list" id="historyList">
<div class="no-history">No past instructions yet.</div>
</div>
</div>
</aside>
<!-- Main Interactive Area -->
<main class="main-content">
<!-- Dual-pane Grid -->
<div class="playground-grid">
<!-- Input Section -->
<section class="pane input-pane">
<div class="pane-header">
<span class="pane-number">01</span>
<h2>Input Prompt</h2>
</div>
<div class="pane-body">
<div class="input-container">
<label for="instructionInput">Instruction <span class="required">*</span></label>
<textarea id="instructionInput" placeholder="e.g. Write a Python function that parses CSV data and handles missing values..." required></textarea>
</div>
<div class="input-container">
<label for="contextInput">Context Input <span class="optional">(Optional)</span></label>
<textarea id="contextInput" placeholder="Add helper definitions, schemas, or existing code variables here..."></textarea>
</div>
<div class="quick-templates">
<span class="templates-label">Quick examples:</span>
<div class="template-tags">
<button class="tag-btn" data-inst="Write a Python class for a thread-safe Singleton pattern." data-ctx="">Singleton Pattern</button>
<button class="tag-btn" data-inst="Write a JavaScript function to throttle a callback invocation." data-ctx="">Throttle Function</button>
<button class="tag-btn" data-inst="Create a robust regular expression in Python for validating email addresses." data-ctx="emails = ['test@example.com', 'invalid-email', 'hello.world@sub.co.uk']">Email Validator</button>
</div>
</div>
<button class="generate-btn" id="generateBtn">
<span class="btn-text">Generate Code</span>
<svg class="btn-arrow" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="5" y1="12" x2="19" y2="12"></line>
<polyline points="12 5 19 12 12 19"></polyline>
</svg>
<div class="btn-spinner hidden"></div>
</button>
</div>
</section>
<!-- Output Section -->
<section class="pane output-pane">
<div class="pane-header">
<span class="pane-number">02</span>
<h2>Generated Code</h2>
<div class="output-actions">
<span class="latency-timer hidden" id="latencyTimer">0.00s</span>
<button class="copy-btn" id="copyBtn" title="Copy Code" disabled>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
</svg>
<span>Copy</span>
</button>
</div>
</div>
<div class="pane-body terminal-container">
<!-- Code block wrapper -->
<div class="code-wrapper" id="codeWrapper">
<div class="terminal-dots">
<span class="dot red"></span>
<span class="dot yellow"></span>
<span class="dot green"></span>
<span class="terminal-title">gemma-assistant.output</span>
</div>
<pre><code class="language-python" id="codeOutput"># Fine-tuned Gemma Code output will be rendered here.
# Tweak your parameters and click "Generate Code" on the left panel.</code></pre>
<!-- Loading skeleton -->
<div class="skeleton-loader hidden" id="skeletonLoader">
<div class="skeleton-line w-75"></div>
<div class="skeleton-line w-100"></div>
<div class="skeleton-line w-50"></div>
<div class="skeleton-line w-85"></div>
<div class="skeleton-line w-60"></div>
</div>
</div>
</div>
</section>
</div>
</main>
</div>
<!-- Toast Notifications -->
<div id="toastContainer" class="toast-container"></div>
</div>
<!-- PrismJS Scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-javascript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
<!-- Custom Application Script -->
<script src="/static/app.js"></script>
</body>
</html>