Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +191 -19
- prompts.txt +1 -0
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: ai-code-snippet-viewer
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: green
|
| 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,191 @@
|
|
| 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>AI Code Snippet Viewer</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/atom-one-dark.min.css">
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
|
| 10 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/languages/python.min.js"></script>
|
| 11 |
+
<style>
|
| 12 |
+
.code-container {
|
| 13 |
+
position: relative;
|
| 14 |
+
}
|
| 15 |
+
.copy-btn {
|
| 16 |
+
position: absolute;
|
| 17 |
+
right: 10px;
|
| 18 |
+
top: 10px;
|
| 19 |
+
opacity: 0;
|
| 20 |
+
transition: opacity 0.2s;
|
| 21 |
+
}
|
| 22 |
+
.code-container:hover .copy-btn {
|
| 23 |
+
opacity: 1;
|
| 24 |
+
}
|
| 25 |
+
.tab-active {
|
| 26 |
+
border-bottom: 3px solid #3b82f6;
|
| 27 |
+
color: #3b82f6;
|
| 28 |
+
font-weight: 600;
|
| 29 |
+
}
|
| 30 |
+
pre {
|
| 31 |
+
margin: 0;
|
| 32 |
+
border-radius: 0.5rem;
|
| 33 |
+
}
|
| 34 |
+
.hljs {
|
| 35 |
+
padding: 1.5rem !important;
|
| 36 |
+
background: #1e293b !important;
|
| 37 |
+
}
|
| 38 |
+
</style>
|
| 39 |
+
</head>
|
| 40 |
+
<body class="bg-gray-50 min-h-screen">
|
| 41 |
+
<div class="container mx-auto px-4 py-12 max-w-5xl">
|
| 42 |
+
<div class="text-center mb-12">
|
| 43 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-2">AI Code Snippet Viewer</h1>
|
| 44 |
+
<p class="text-gray-600 max-w-2xl mx-auto">
|
| 45 |
+
Explore and copy ready-to-use code snippets for integrating various AI providers into your applications.
|
| 46 |
+
</p>
|
| 47 |
+
</div>
|
| 48 |
+
|
| 49 |
+
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
|
| 50 |
+
<!-- Header with tabs -->
|
| 51 |
+
<div class="border-b border-gray-200">
|
| 52 |
+
<div class="flex px-6 pt-4">
|
| 53 |
+
<div class="flex space-x-8">
|
| 54 |
+
<button id="huggingface-tab" class="tab-active py-3 px-1 text-sm font-medium">
|
| 55 |
+
Hugging Face
|
| 56 |
+
</button>
|
| 57 |
+
<button id="gemini-tab" class="py-3 px-1 text-sm font-medium text-gray-500 hover:text-gray-700">
|
| 58 |
+
Gemini Coder
|
| 59 |
+
</button>
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<!-- Content area -->
|
| 65 |
+
<div class="p-6">
|
| 66 |
+
<!-- Provider description -->
|
| 67 |
+
<div id="huggingface-desc" class="mb-6">
|
| 68 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-2">Hugging Face Integration</h3>
|
| 69 |
+
<p class="text-gray-600">
|
| 70 |
+
This snippet demonstrates how to integrate Hugging Face's DeepSeek-R1 model into your Gradio application.
|
| 71 |
+
The code loads the model from the AI Gradio registry with coder capabilities enabled.
|
| 72 |
+
</p>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<div id="gemini-desc" class="mb-6 hidden">
|
| 76 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-2">Gemini Coder Integration</h3>
|
| 77 |
+
<p class="text-gray-600">
|
| 78 |
+
This snippet shows how to use Google's Gemini 2.5 Pro model with coder capabilities in your Gradio application.
|
| 79 |
+
The model is loaded from the AI Gradio registry with the Together provider.
|
| 80 |
+
</p>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<!-- Code display -->
|
| 84 |
+
<div class="code-container">
|
| 85 |
+
<pre id="code-display"><code class="language-python">import gradio as gr
|
| 86 |
+
import ai_gradio
|
| 87 |
+
gr.load(
|
| 88 |
+
name='huggingface:deepseek-ai/DeepSeek-R1',
|
| 89 |
+
src=ai_gradio.registry,
|
| 90 |
+
coder=True,
|
| 91 |
+
provider="together"
|
| 92 |
+
).launch()</code></pre>
|
| 93 |
+
<button class="copy-btn bg-blue-500 hover:bg-blue-600 text-white px-3 py-1 rounded text-sm" onclick="copyCode()">
|
| 94 |
+
Copy
|
| 95 |
+
</button>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<!-- Demo section -->
|
| 99 |
+
<div class="mt-8">
|
| 100 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-4">Live Demo</h3>
|
| 101 |
+
<div class="bg-gray-100 rounded-lg p-6">
|
| 102 |
+
<div class="flex items-center space-x-4 mb-4">
|
| 103 |
+
<div class="w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center text-white font-bold">HF</div>
|
| 104 |
+
<div>
|
| 105 |
+
<p class="font-medium">Hugging Face Demo</p>
|
| 106 |
+
<p class="text-sm text-gray-500">Try the DeepSeek-R1 model</p>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="bg-white rounded-lg p-4 shadow-inner">
|
| 110 |
+
<p class="text-gray-600 italic">Demo interface would appear here...</p>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
|
| 117 |
+
<div class="mt-8 text-center text-gray-500 text-sm">
|
| 118 |
+
<p>Need help integrating these snippets? <a href="#" class="text-blue-500 hover:underline">Contact support</a></p>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<script>
|
| 123 |
+
// Initialize syntax highlighting
|
| 124 |
+
document.addEventListener('DOMContentLoaded', (event) => {
|
| 125 |
+
hljs.highlightAll();
|
| 126 |
+
});
|
| 127 |
+
|
| 128 |
+
// Tab switching functionality
|
| 129 |
+
const tabs = {
|
| 130 |
+
'huggingface-tab': {
|
| 131 |
+
desc: 'huggingface-desc',
|
| 132 |
+
code: `import gradio as gr
|
| 133 |
+
import ai_gradio
|
| 134 |
+
gr.load(
|
| 135 |
+
name='huggingface:deepseek-ai/DeepSeek-R1',
|
| 136 |
+
src=ai_gradio.registry,
|
| 137 |
+
coder=True,
|
| 138 |
+
provider="together"
|
| 139 |
+
).launch()`
|
| 140 |
+
},
|
| 141 |
+
'gemini-tab': {
|
| 142 |
+
desc: 'gemini-desc',
|
| 143 |
+
code: `import gradio as gr
|
| 144 |
+
import ai_gradio
|
| 145 |
+
gr.load(
|
| 146 |
+
name='gemini:gemini-2.5-pro-exp-03-25',
|
| 147 |
+
src=ai_gradio.registry,
|
| 148 |
+
coder=True,
|
| 149 |
+
provider="together"
|
| 150 |
+
).launch()`
|
| 151 |
+
}
|
| 152 |
+
};
|
| 153 |
+
|
| 154 |
+
Object.keys(tabs).forEach(tabId => {
|
| 155 |
+
document.getElementById(tabId).addEventListener('click', () => {
|
| 156 |
+
// Update active tab styling
|
| 157 |
+
Object.keys(tabs).forEach(id => {
|
| 158 |
+
const tab = document.getElementById(id);
|
| 159 |
+
tab.classList.remove('tab-active', 'text-blue-600');
|
| 160 |
+
tab.classList.add('text-gray-500');
|
| 161 |
+
});
|
| 162 |
+
const activeTab = document.getElementById(tabId);
|
| 163 |
+
activeTab.classList.add('tab-active', 'text-blue-600');
|
| 164 |
+
activeTab.classList.remove('text-gray-500');
|
| 165 |
+
|
| 166 |
+
// Update content
|
| 167 |
+
Object.values(tabs).forEach(content => {
|
| 168 |
+
document.getElementById(content.desc).classList.add('hidden');
|
| 169 |
+
});
|
| 170 |
+
document.getElementById(tabs[tabId].desc).classList.remove('hidden');
|
| 171 |
+
|
| 172 |
+
// Update code
|
| 173 |
+
document.getElementById('code-display').textContent = tabs[tabId].code;
|
| 174 |
+
hljs.highlightAll();
|
| 175 |
+
});
|
| 176 |
+
});
|
| 177 |
+
|
| 178 |
+
// Copy code functionality
|
| 179 |
+
function copyCode() {
|
| 180 |
+
const code = document.getElementById('code-display').textContent;
|
| 181 |
+
navigator.clipboard.writeText(code).then(() => {
|
| 182 |
+
const btn = document.querySelector('.copy-btn');
|
| 183 |
+
btn.textContent = 'Copied!';
|
| 184 |
+
setTimeout(() => {
|
| 185 |
+
btn.textContent = 'Copy';
|
| 186 |
+
}, 2000);
|
| 187 |
+
});
|
| 188 |
+
}
|
| 189 |
+
</script>
|
| 190 |
+
<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=Boobs00/ai-code-snippet-viewer" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 191 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Reitorate and implement optimized and refined robust.
|