Spaces:
Running
Running
Tu Nombre commited on
Commit ·
3fad336
1
Parent(s): beb29f0
Actualización: Cambio a modelo Llama 3.1 8B
Browse files- README.md +5 -4
- index.html +0 -116
- requirements.txt +3 -0
README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: gray
|
| 6 |
-
sdk:
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
|
|
|
| 1 |
---
|
| 2 |
+
title: TubeBot
|
| 3 |
+
emoji: 🤖
|
| 4 |
+
colorFrom: red
|
| 5 |
colorTo: gray
|
| 6 |
+
sdk: gradio
|
| 7 |
+
python_version: "3.10"
|
| 8 |
pinned: false
|
| 9 |
---
|
index.html
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 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 |
-
<title>Generador de Publicaciones</title>
|
| 7 |
-
<link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;700;800&family=DM+Sans:wght@300;400&display=swap" rel="stylesheet">
|
| 8 |
-
<style>
|
| 9 |
-
:root{--gold:#D4AF37;--gold2:#f0c940;--bg:#0a0a0a;--card:#111;--border:#222;--text:#e8e8e8;--muted:#666;}
|
| 10 |
-
*{box-sizing:border-box;margin:0;padding:0;}
|
| 11 |
-
body{background:var(--bg);color:var(--text);font-family:'DM Sans',sans-serif;min-height:100vh;padding:30px 16px 60px;}
|
| 12 |
-
header{text-align:center;margin-bottom:36px;}
|
| 13 |
-
header h1{font-family:'Syne',sans-serif;font-size:clamp(1.8rem,5vw,2.8rem);font-weight:800;color:var(--gold);}
|
| 14 |
-
header p{color:var(--muted);font-size:0.95rem;margin-top:8px;font-style:italic;}
|
| 15 |
-
.controls{max-width:680px;margin:0 auto 32px;display:flex;flex-direction:column;gap:14px;}
|
| 16 |
-
label{font-size:0.8rem;letter-spacing:2px;text-transform:uppercase;color:var(--gold);font-family:'Syne',sans-serif;margin-bottom:4px;display:block;}
|
| 17 |
-
input,select{width:100%;background:var(--card);border:1px solid var(--border);color:var(--text);padding:12px 16px;border-radius:10px;font-family:'DM Sans',sans-serif;font-size:0.95rem;outline:none;transition:border-color 0.2s;}
|
| 18 |
-
input:focus,select:focus{border-color:var(--gold);}
|
| 19 |
-
select option{background:#111;}
|
| 20 |
-
.btn{width:100%;background:var(--gold);color:#000;border:none;padding:15px;border-radius:10px;font-family:'Syne',sans-serif;font-size:1rem;font-weight:800;cursor:pointer;transition:background 0.2s;}
|
| 21 |
-
.btn:hover{background:var(--gold2);}
|
| 22 |
-
.btn:disabled{opacity:0.5;cursor:not-allowed;}
|
| 23 |
-
.loading{text-align:center;padding:40px;color:var(--gold);font-family:'Syne',sans-serif;font-size:1.1rem;display:none;}
|
| 24 |
-
.loading span{display:inline-block;animation:pulse 1.2s ease-in-out infinite;}
|
| 25 |
-
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:0.3;}}
|
| 26 |
-
.posts-grid{max-width:680px;margin:0 auto;display:flex;flex-direction:column;gap:16px;}
|
| 27 |
-
.post-card{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:20px;animation:fadeUp 0.4s ease both;}
|
| 28 |
-
@keyframes fadeUp{from{opacity:0;transform:translateY(16px);}to{opacity:1;transform:translateY(0);}}
|
| 29 |
-
.post-num{font-family:'Syne',sans-serif;font-size:0.72rem;letter-spacing:3px;text-transform:uppercase;color:var(--gold);margin-bottom:10px;}
|
| 30 |
-
.post-text{font-size:0.95rem;line-height:1.7;color:var(--text);white-space:pre-wrap;}
|
| 31 |
-
.post-actions{display:flex;gap:10px;margin-top:14px;}
|
| 32 |
-
.btn-copy{flex:1;background:transparent;border:1px solid var(--gold);color:var(--gold);padding:9px 14px;border-radius:8px;font-family:'Syne',sans-serif;font-size:0.8rem;font-weight:700;cursor:pointer;transition:all 0.2s;}
|
| 33 |
-
.btn-copy:hover{background:var(--gold);color:#000;}
|
| 34 |
-
.btn-copy.copied{background:#1a3a1a;border-color:#4caf50;color:#4caf50;}
|
| 35 |
-
.error{max-width:680px;margin:0 auto;background:#1a0a0a;border:1px solid #5a1a1a;color:#ff6b6b;padding:16px 20px;border-radius:10px;font-size:0.9rem;display:none;}
|
| 36 |
-
</style>
|
| 37 |
-
</head>
|
| 38 |
-
<body>
|
| 39 |
-
<header>
|
| 40 |
-
<h1>⚡ GENERADOR DE POSTS</h1>
|
| 41 |
-
<p>10 publicaciones de valor listas para copiar y pegar</p>
|
| 42 |
-
</header>
|
| 43 |
-
<div class="controls">
|
| 44 |
-
<div>
|
| 45 |
-
<label>Tu servicio o nicho</label>
|
| 46 |
-
<input type="text" id="servicio" placeholder="Ej: Canales de YouTube automatizados con IA" />
|
| 47 |
-
</div>
|
| 48 |
-
<div>
|
| 49 |
-
<label>Tipo de grupos</label>
|
| 50 |
-
<select id="tipo">
|
| 51 |
-
<option value="emprendedores">Emprendedores</option>
|
| 52 |
-
<option value="marketing digital">Marketing Digital</option>
|
| 53 |
-
<option value="negocios online">Negocios Online</option>
|
| 54 |
-
<option value="freelancers">Freelancers</option>
|
| 55 |
-
<option value="inversiones">Inversiones y Dinero</option>
|
| 56 |
-
</select>
|
| 57 |
-
</div>
|
| 58 |
-
<div>
|
| 59 |
-
<label>Tu llamada a la acción</label>
|
| 60 |
-
<input type="text" id="cta" placeholder="Ej: Escríbeme por WhatsApp al +34..." />
|
| 61 |
-
</div>
|
| 62 |
-
<button class="btn" id="generarBtn" onclick="generarPosts()">🔥 GENERAR 10 PUBLICACIONES</button>
|
| 63 |
-
</div>
|
| 64 |
-
<div class="loading" id="loading"><span>⚡ Generando con Groq...</span></div>
|
| 65 |
-
<div class="error" id="error"></div>
|
| 66 |
-
<div class="posts-grid" id="postsGrid"></div>
|
| 67 |
-
<script>
|
| 68 |
-
const GROQ_KEY = "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";
|
| 69 |
-
async function generarPosts(){
|
| 70 |
-
const servicio=document.getElementById('servicio').value.trim();
|
| 71 |
-
const tipo=document.getElementById('tipo').value;
|
| 72 |
-
const cta=document.getElementById('cta').value.trim();
|
| 73 |
-
if(!servicio){alert('Escribe tu servicio');return;}
|
| 74 |
-
const btn=document.getElementById('generarBtn');
|
| 75 |
-
const loading=document.getElementById('loading');
|
| 76 |
-
const grid=document.getElementById('postsGrid');
|
| 77 |
-
const errorDiv=document.getElementById('error');
|
| 78 |
-
btn.disabled=true;loading.style.display='block';grid.innerHTML='';errorDiv.style.display='none';
|
| 79 |
-
const prompt=`Eres experto en marketing para redes sociales hispanohablantes. Genera EXACTAMENTE 10 publicaciones de valor para grupos de Facebook de ${tipo}. Servicio: ${servicio}. CTA al final de cada post: ${cta||'Contáctame para más info'}. REGLAS: aporta valor real, no parezcan anuncios directos, tono cercano y humano, 3-6 párrafos, emojis moderados, varía formatos (storytelling, tips, pregunta, dato, error común). Responde ÚNICAMENTE con JSON válido sin markdown: {"posts":["post1","post2","post3","post4","post5","post6","post7","post8","post9","post10"]}`;
|
| 80 |
-
try{
|
| 81 |
-
const res=await fetch('https://api.groq.com/openai/v1/chat/completions',{
|
| 82 |
-
method:'POST',
|
| 83 |
-
headers:{'Content-Type':'application/json','Authorization':'Bearer '+GROQ_KEY},
|
| 84 |
-
body:JSON.stringify({model:'llama-3.3-70b-versatile',temperature:0.82,messages:[{role:'user',content:prompt}]})
|
| 85 |
-
});
|
| 86 |
-
const data=await res.json();
|
| 87 |
-
if(!res.ok)throw new Error(data.error?.message||'Error de Groq');
|
| 88 |
-
const text=data.choices[0].message.content;
|
| 89 |
-
const clean=text.replace(/```json|```/g,'').trim();
|
| 90 |
-
const parsed=JSON.parse(clean);
|
| 91 |
-
const posts=parsed.posts;
|
| 92 |
-
if(!posts||posts.length===0)throw new Error('No se generaron publicaciones');
|
| 93 |
-
posts.forEach((post,i)=>{
|
| 94 |
-
const card=document.createElement('div');
|
| 95 |
-
card.className='post-card';
|
| 96 |
-
card.style.animationDelay=`${i*0.07}s`;
|
| 97 |
-
card.innerHTML=`<div class="post-num">📌 Publicación ${i+1} de 10</div><div class="post-text">${post.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>')}</div><div class="post-actions"><button class="btn-copy" onclick="copiar(this,${i})">📋 Copiar</button></div>`;
|
| 98 |
-
grid.appendChild(card);
|
| 99 |
-
});
|
| 100 |
-
window._posts=posts;
|
| 101 |
-
}catch(err){
|
| 102 |
-
errorDiv.textContent='❌ Error: '+err.message;
|
| 103 |
-
errorDiv.style.display='block';
|
| 104 |
-
}finally{
|
| 105 |
-
btn.disabled=false;loading.style.display='none';
|
| 106 |
-
}
|
| 107 |
-
}
|
| 108 |
-
function copiar(btn,index){
|
| 109 |
-
navigator.clipboard.writeText(window._posts[index]).then(()=>{
|
| 110 |
-
btn.textContent='✅ Copiado';btn.classList.add('copied');
|
| 111 |
-
setTimeout(()=>{btn.textContent='📋 Copiar';btn.classList.remove('copied');},2000);
|
| 112 |
-
});
|
| 113 |
-
}
|
| 114 |
-
</script>
|
| 115 |
-
</body>
|
| 116 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi
|
| 2 |
+
uvicorn
|
| 3 |
+
httpx
|