ElJoker63 commited on
Commit ·
d2c2e46
1
Parent(s): 9f439ec
- app.py +3 -3
- static/index.html +41 -22
- test.py +1 -1
app.py
CHANGED
|
@@ -39,8 +39,8 @@ import gradio as gr
|
|
| 39 |
# Setup lifespan context manager
|
| 40 |
@asynccontextmanager
|
| 41 |
async def lifespan(app: FastAPI):
|
| 42 |
-
# Startup: By default, setup
|
| 43 |
-
threading.Thread(target=setup_model_task, args=("
|
| 44 |
yield
|
| 45 |
# Shutdown: Unload active model to release resources
|
| 46 |
unload_model()
|
|
@@ -94,7 +94,7 @@ os.makedirs(CACHE_DIR, exist_ok=True)
|
|
| 94 |
status = {
|
| 95 |
"state": "initializing", # initializing, downloading, loading, ready, error
|
| 96 |
"active_model": None,
|
| 97 |
-
"target_model": "
|
| 98 |
"progress": 0.0,
|
| 99 |
"speed_mbps": 0.0,
|
| 100 |
"error": None,
|
|
|
|
| 39 |
# Setup lifespan context manager
|
| 40 |
@asynccontextmanager
|
| 41 |
async def lifespan(app: FastAPI):
|
| 42 |
+
# Startup: By default, setup mythos-nano on startup
|
| 43 |
+
threading.Thread(target=setup_model_task, args=("mythos-nano",), daemon=True).start()
|
| 44 |
yield
|
| 45 |
# Shutdown: Unload active model to release resources
|
| 46 |
unload_model()
|
|
|
|
| 94 |
status = {
|
| 95 |
"state": "initializing", # initializing, downloading, loading, ready, error
|
| 96 |
"active_model": None,
|
| 97 |
+
"target_model": "mythos-nano",
|
| 98 |
"progress": 0.0,
|
| 99 |
"speed_mbps": 0.0,
|
| 100 |
"error": None,
|
static/index.html
CHANGED
|
@@ -1,14 +1,18 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="es">
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<meta name="description"
|
|
|
|
| 7 |
<title>UDYAT AI 🌌 - Chat & API</title>
|
| 8 |
<!-- Google Fonts -->
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
-
<link
|
|
|
|
|
|
|
| 12 |
<!-- Prism.js for code syntax highlighting -->
|
| 13 |
<link href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
|
| 14 |
<!-- Main Style -->
|
|
@@ -18,9 +22,10 @@
|
|
| 18 |
<!-- Marked for Markdown rendering -->
|
| 19 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 20 |
</head>
|
|
|
|
| 21 |
<body>
|
| 22 |
<div class="app-container">
|
| 23 |
-
|
| 24 |
<!-- Loading / Downloading Overlay -->
|
| 25 |
<div id="loading-overlay" class="overlay active">
|
| 26 |
<div class="overlay-glass">
|
|
@@ -35,11 +40,14 @@
|
|
| 35 |
<span class="separator">•</span>
|
| 36 |
<span id="download-speed">0 MB/s</span>
|
| 37 |
</div>
|
| 38 |
-
|
| 39 |
<!-- Dropdown selector on loading screen for error recovery -->
|
| 40 |
<div class="overlay-select-container" style="margin-top: 1.5rem; width: 100%;">
|
| 41 |
-
<p
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
<option value="mythos-nano">Mythos Nano (3B)</option>
|
| 44 |
<option value="qwen-2.5-3b" selected>Qwen 2.5 (3B) Instruct</option>
|
| 45 |
<option value="llama-3.2-3b">Llama 3.2 (3B) Instruct</option>
|
|
@@ -60,7 +68,7 @@
|
|
| 60 |
<i data-lucide="plus"></i>
|
| 61 |
</button>
|
| 62 |
</div>
|
| 63 |
-
|
| 64 |
<div class="history-section">
|
| 65 |
<h3>CONVERSACIONES</h3>
|
| 66 |
<div id="chat-history-list" class="history-list">
|
|
@@ -90,8 +98,8 @@
|
|
| 90 |
<div class="model-select-container">
|
| 91 |
<i data-lucide="cpu" class="select-icon"></i>
|
| 92 |
<select id="model-select" class="model-select">
|
| 93 |
-
<option value="mythos-nano">Mythos Nano (3B)</option>
|
| 94 |
-
<option value="qwen-2.5-3b"
|
| 95 |
<option value="llama-3.2-3b">Llama 3.2 (3B) Instruct</option>
|
| 96 |
<option value="claude-oss-350m">Claude OSS (350M)</option>
|
| 97 |
</select>
|
|
@@ -118,7 +126,8 @@
|
|
| 118 |
<div class="welcome-container">
|
| 119 |
<i data-lucide="bot" class="welcome-icon"></i>
|
| 120 |
<h1 id="welcome-title">Hola, soy Mythos-nano</h1>
|
| 121 |
-
<p id="welcome-desc">Un modelo de razonamiento y codificación de 3 mil millones de
|
|
|
|
| 122 |
<div class="suggestions">
|
| 123 |
<div class="suggestion-card" onclick="useSuggestion(this)">
|
| 124 |
<h4>Resolver Ecuación</h4>
|
|
@@ -131,16 +140,18 @@
|
|
| 131 |
</div>
|
| 132 |
</div>
|
| 133 |
</div>
|
| 134 |
-
|
| 135 |
<div class="chat-input-area">
|
| 136 |
<form id="chat-form">
|
| 137 |
-
<textarea id="chat-input" placeholder="Pregúntame lo que quieras..." rows="1"
|
|
|
|
| 138 |
<button type="submit" id="send-btn" class="icon-btn btn-primary" title="Enviar Mensaje">
|
| 139 |
<i data-lucide="send"></i>
|
| 140 |
</button>
|
| 141 |
</form>
|
| 142 |
<div class="input-footer">
|
| 143 |
-
<span>Mythos-nano puede cometer errores. Considera verificar la información
|
|
|
|
| 144 |
</div>
|
| 145 |
</div>
|
| 146 |
</section>
|
|
@@ -150,14 +161,18 @@
|
|
| 150 |
<div class="api-container">
|
| 151 |
<div class="api-header">
|
| 152 |
<h2>Documentación de la API</h2>
|
| 153 |
-
<p>Este espacio expone un servidor compatible con la API de OpenAI en el puerto actual.
|
|
|
|
|
|
|
| 154 |
</div>
|
| 155 |
|
| 156 |
<div class="api-card">
|
| 157 |
<h3>Detalles del Servidor</h3>
|
| 158 |
<div class="api-details">
|
| 159 |
-
<p><strong>URL Base:</strong> <code class="url-code"
|
| 160 |
-
|
|
|
|
|
|
|
| 161 |
</div>
|
| 162 |
</div>
|
| 163 |
|
|
@@ -166,9 +181,10 @@
|
|
| 166 |
<div class="code-tabs">
|
| 167 |
<button class="code-tab active" onclick="switchCodeTab(event, 'curl')">cURL</button>
|
| 168 |
<button class="code-tab" onclick="switchCodeTab(event, 'python')">Python</button>
|
| 169 |
-
<button class="code-tab"
|
|
|
|
| 170 |
</div>
|
| 171 |
-
|
| 172 |
<div class="code-content-container">
|
| 173 |
<div id="code-curl" class="code-content-block active">
|
| 174 |
<button class="copy-code-btn" onclick="copyApiCode('curl-code-snippet')">
|
|
@@ -253,12 +269,14 @@ generateChat();</code></pre>
|
|
| 253 |
<div class="drawer-content">
|
| 254 |
<div class="setting-group">
|
| 255 |
<label for="system-prompt">System Prompt</label>
|
| 256 |
-
<textarea id="system-prompt"
|
|
|
|
| 257 |
</div>
|
| 258 |
<div class="setting-group">
|
| 259 |
<label for="temp-slider">Temperatura: <span id="temp-val">0.7</span></label>
|
| 260 |
<input type="range" id="temp-slider" min="0.0" max="1.5" step="0.1" value="0.7">
|
| 261 |
-
<span class="setting-desc">Valores altos aumentan la creatividad, valores bajos la hacen más
|
|
|
|
| 262 |
</div>
|
| 263 |
<div class="setting-group">
|
| 264 |
<label for="tokens-input">Tokens Máximos</label>
|
|
@@ -273,8 +291,9 @@ generateChat();</code></pre>
|
|
| 273 |
<!-- Prism Core & Autoloader for dynamic code blocks syntax styling -->
|
| 274 |
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js"></script>
|
| 275 |
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
| 276 |
-
|
| 277 |
<!-- Main JS logic -->
|
| 278 |
<script src="/static/app.js"></script>
|
| 279 |
</body>
|
| 280 |
-
|
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="es">
|
| 3 |
+
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<meta name="description"
|
| 8 |
+
content="Interfaz web premium y API compatible con OpenAI para UDYAT AI. Servido con alta velocidad y diseño glassmorphism.">
|
| 9 |
<title>UDYAT AI 🌌 - Chat & API</title>
|
| 10 |
<!-- Google Fonts -->
|
| 11 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 12 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 13 |
+
<link
|
| 14 |
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap"
|
| 15 |
+
rel="stylesheet">
|
| 16 |
<!-- Prism.js for code syntax highlighting -->
|
| 17 |
<link href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
|
| 18 |
<!-- Main Style -->
|
|
|
|
| 22 |
<!-- Marked for Markdown rendering -->
|
| 23 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
| 24 |
</head>
|
| 25 |
+
|
| 26 |
<body>
|
| 27 |
<div class="app-container">
|
| 28 |
+
|
| 29 |
<!-- Loading / Downloading Overlay -->
|
| 30 |
<div id="loading-overlay" class="overlay active">
|
| 31 |
<div class="overlay-glass">
|
|
|
|
| 40 |
<span class="separator">•</span>
|
| 41 |
<span id="download-speed">0 MB/s</span>
|
| 42 |
</div>
|
| 43 |
+
|
| 44 |
<!-- Dropdown selector on loading screen for error recovery -->
|
| 45 |
<div class="overlay-select-container" style="margin-top: 1.5rem; width: 100%;">
|
| 46 |
+
<p
|
| 47 |
+
style="font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;">
|
| 48 |
+
Cambiar de modelo:</p>
|
| 49 |
+
<select id="overlay-model-select" class="model-select"
|
| 50 |
+
style="width: 100%; border: 1px solid var(--border-glass); background: rgba(255,255,255,0.05); padding: 0.5rem 0.75rem; border-radius: 8px; color: var(--text-primary); font-family: var(--font-header); font-weight: 600; font-size: 0.9rem; text-align-last: center; cursor: pointer; outline: none;">
|
| 51 |
<option value="mythos-nano">Mythos Nano (3B)</option>
|
| 52 |
<option value="qwen-2.5-3b" selected>Qwen 2.5 (3B) Instruct</option>
|
| 53 |
<option value="llama-3.2-3b">Llama 3.2 (3B) Instruct</option>
|
|
|
|
| 68 |
<i data-lucide="plus"></i>
|
| 69 |
</button>
|
| 70 |
</div>
|
| 71 |
+
|
| 72 |
<div class="history-section">
|
| 73 |
<h3>CONVERSACIONES</h3>
|
| 74 |
<div id="chat-history-list" class="history-list">
|
|
|
|
| 98 |
<div class="model-select-container">
|
| 99 |
<i data-lucide="cpu" class="select-icon"></i>
|
| 100 |
<select id="model-select" class="model-select">
|
| 101 |
+
<option value="mythos-nano" selected>Mythos Nano (3B)</option>
|
| 102 |
+
<option value="qwen-2.5-3b">Qwen 2.5 (3B) Instruct</option>
|
| 103 |
<option value="llama-3.2-3b">Llama 3.2 (3B) Instruct</option>
|
| 104 |
<option value="claude-oss-350m">Claude OSS (350M)</option>
|
| 105 |
</select>
|
|
|
|
| 126 |
<div class="welcome-container">
|
| 127 |
<i data-lucide="bot" class="welcome-icon"></i>
|
| 128 |
<h1 id="welcome-title">Hola, soy Mythos-nano</h1>
|
| 129 |
+
<p id="welcome-desc">Un modelo de razonamiento y codificación de 3 mil millones de
|
| 130 |
+
parámetros optimizado para alto rendimiento.</p>
|
| 131 |
<div class="suggestions">
|
| 132 |
<div class="suggestion-card" onclick="useSuggestion(this)">
|
| 133 |
<h4>Resolver Ecuación</h4>
|
|
|
|
| 140 |
</div>
|
| 141 |
</div>
|
| 142 |
</div>
|
| 143 |
+
|
| 144 |
<div class="chat-input-area">
|
| 145 |
<form id="chat-form">
|
| 146 |
+
<textarea id="chat-input" placeholder="Pregúntame lo que quieras..." rows="1"
|
| 147 |
+
required></textarea>
|
| 148 |
<button type="submit" id="send-btn" class="icon-btn btn-primary" title="Enviar Mensaje">
|
| 149 |
<i data-lucide="send"></i>
|
| 150 |
</button>
|
| 151 |
</form>
|
| 152 |
<div class="input-footer">
|
| 153 |
+
<span>Mythos-nano puede cometer errores. Considera verificar la información
|
| 154 |
+
importante.</span>
|
| 155 |
</div>
|
| 156 |
</div>
|
| 157 |
</section>
|
|
|
|
| 161 |
<div class="api-container">
|
| 162 |
<div class="api-header">
|
| 163 |
<h2>Documentación de la API</h2>
|
| 164 |
+
<p>Este espacio expone un servidor compatible con la API de OpenAI en el puerto actual.
|
| 165 |
+
Puedes utilizarlo en tus scripts de automatización, extensiones de VS Code, herramientas
|
| 166 |
+
de desarrollo o clientes HTTP.</p>
|
| 167 |
</div>
|
| 168 |
|
| 169 |
<div class="api-card">
|
| 170 |
<h3>Detalles del Servidor</h3>
|
| 171 |
<div class="api-details">
|
| 172 |
+
<p><strong>URL Base:</strong> <code class="url-code"
|
| 173 |
+
id="api-base-url">http://localhost:7860</code></p>
|
| 174 |
+
<p><strong>Formato de Autenticación:</strong> Libre (o Bearer Token de Hugging Face si
|
| 175 |
+
el espacio es privado).</p>
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
|
|
|
|
| 181 |
<div class="code-tabs">
|
| 182 |
<button class="code-tab active" onclick="switchCodeTab(event, 'curl')">cURL</button>
|
| 183 |
<button class="code-tab" onclick="switchCodeTab(event, 'python')">Python</button>
|
| 184 |
+
<button class="code-tab"
|
| 185 |
+
onclick="switchCodeTab(event, 'javascript')">JavaScript</button>
|
| 186 |
</div>
|
| 187 |
+
|
| 188 |
<div class="code-content-container">
|
| 189 |
<div id="code-curl" class="code-content-block active">
|
| 190 |
<button class="copy-code-btn" onclick="copyApiCode('curl-code-snippet')">
|
|
|
|
| 269 |
<div class="drawer-content">
|
| 270 |
<div class="setting-group">
|
| 271 |
<label for="system-prompt">System Prompt</label>
|
| 272 |
+
<textarea id="system-prompt"
|
| 273 |
+
rows="4">Eres un asistente de inteligencia artificial útil, honesto y capaz. Responde siempre con respuestas precisas y estructuradas.</textarea>
|
| 274 |
</div>
|
| 275 |
<div class="setting-group">
|
| 276 |
<label for="temp-slider">Temperatura: <span id="temp-val">0.7</span></label>
|
| 277 |
<input type="range" id="temp-slider" min="0.0" max="1.5" step="0.1" value="0.7">
|
| 278 |
+
<span class="setting-desc">Valores altos aumentan la creatividad, valores bajos la hacen más
|
| 279 |
+
precisa y determinista.</span>
|
| 280 |
</div>
|
| 281 |
<div class="setting-group">
|
| 282 |
<label for="tokens-input">Tokens Máximos</label>
|
|
|
|
| 291 |
<!-- Prism Core & Autoloader for dynamic code blocks syntax styling -->
|
| 292 |
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js"></script>
|
| 293 |
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
|
| 294 |
+
|
| 295 |
<!-- Main JS logic -->
|
| 296 |
<script src="/static/app.js"></script>
|
| 297 |
</body>
|
| 298 |
+
|
| 299 |
+
</html>
|
test.py
CHANGED
|
@@ -27,7 +27,7 @@ client = OpenAI(
|
|
| 27 |
try:
|
| 28 |
# 3. Realizar consulta corta de prueba
|
| 29 |
stream = client.chat.completions.create(
|
| 30 |
-
model="
|
| 31 |
messages=[
|
| 32 |
{"role": "system", "content": "Eres un asistente inteligente y conciso."},
|
| 33 |
{"role": "user", "content": "Hola! Dime una sola frase corta de prueba para saber que estás respondiendo."}
|
|
|
|
| 27 |
try:
|
| 28 |
# 3. Realizar consulta corta de prueba
|
| 29 |
stream = client.chat.completions.create(
|
| 30 |
+
model="mythos-nano",
|
| 31 |
messages=[
|
| 32 |
{"role": "system", "content": "Eres un asistente inteligente y conciso."},
|
| 33 |
{"role": "user", "content": "Hola! Dime una sola frase corta de prueba para saber que estás respondiendo."}
|