
import requests import json # 1. Obtener datos de Notion API notion_data = get_notion_data() # [implementar con API de Notion] # 2. Preparar prompt para DeepSeek prompt = f""" Eres mi ME IA de bienestar. Analiza: {json.dumps(notion_data)} Devuelve solo JSON: {{ "patron": str, "accion": str, "pronostico": str }} """ # 3. Consultar API DeepSeek-R1 (gratis) url = "https://api.deepseek.com/v1/chat/completions" headers = {"Authorization": "Bearer TU_API_KEY"} data = { "model": "deepseek-r1", "messages": [{"role": "user", "content": prompt}] } response = requests.post(url, json=data, headers=headers) alerta_ia = response.json()["choices"][0]["message"]["content"] # 4. Actualizar Notion con la alerta update_notion(alerta_ia) # ← ¡Tu ME IA ya funciona! - Follow Up Deployment
55595a6
verified
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Wellness AI Dashboard</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, #667eea 0%, #764ba2 100%); | |
} | |
.pulse-animation { | |
animation: pulse 2s infinite; | |
} | |
@keyframes pulse { | |
0% { transform: scale(1); } | |
50% { transform: scale(1.05); } | |
100% { transform: scale(1); } | |
} | |
.card-hover:hover { | |
transform: translateY(-5px); | |
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); | |
} | |
.smooth-transition { | |
transition: all 0.3s ease; | |
} | |
</style> | |
</head> | |
<body class="bg-gray-50 font-sans"> | |
<div class="min-h-screen flex flex-col"> | |
<!-- Header --> | |
<header class="gradient-bg text-white shadow-lg"> | |
<div class="container mx-auto px-4 py-6"> | |
<div class="flex flex-col md:flex-row justify-between items-center"> | |
<div class="flex items-center mb-4 md:mb-0"> | |
<i class="fas fa-brain text-3xl mr-3"></i> | |
<h1 class="text-2xl font-bold">Wellness AI Dashboard</h1> | |
</div> | |
<div class="flex items-center space-x-4"> | |
<button id="connectNotionBtn" class="bg-white text-indigo-700 px-4 py-2 rounded-lg font-medium hover:bg-indigo-50 smooth-transition"> | |
<i class="fas fa-plug mr-2"></i>Connect Notion | |
</button> | |
<div class="relative"> | |
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Profile" class="w-10 h-10 rounded-full cursor-pointer border-2 border-white"> | |
<span class="absolute top-0 right-0 h-3 w-3 bg-green-400 rounded-full border-2 border-white"></span> | |
</div> | |
</div> | |
</div> | |
</div> | |
</header> | |
<!-- Main Content --> | |
<main class="flex-grow container mx-auto px-4 py-8"> | |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8"> | |
<!-- Left Column --> | |
<div class="lg:col-span-2 space-y-6"> | |
<!-- Notion Data Card --> | |
<div class="bg-white rounded-xl shadow-md overflow-hidden smooth-transition card-hover"> | |
<div class="p-6"> | |
<div class="flex justify-between items-center mb-4"> | |
<h2 class="text-xl font-semibold text-gray-800"> | |
<i class="fas fa-database text-indigo-500 mr-2"></i>Notion Wellness Data | |
</h2> | |
<span class="bg-indigo-100 text-indigo-800 text-xs px-3 py-1 rounded-full">Live</span> | |
</div> | |
<div id="notionData" class="bg-gray-50 p-4 rounded-lg mb-4"> | |
<div class="text-center py-8 text-gray-400"> | |
<i class="fas fa-cloud-download-alt text-3xl mb-2"></i> | |
<p>Connect to Notion to load your wellness data</p> | |
</div> | |
</div> | |
<div class="flex justify-between items-center"> | |
<div class="text-sm text-gray-500"> | |
Last synced: <span id="lastSynced">Never</span> | |
</div> | |
<button id="refreshDataBtn" class="text-indigo-600 hover:text-indigo-800 smooth-transition"> | |
<i class="fas fa-sync-alt mr-1"></i>Refresh | |
</button> | |
</div> | |
</div> | |
</div> | |
<!-- AI Analysis Card --> | |
<div class="bg-white rounded-xl shadow-md overflow-hidden smooth-transition card-hover"> | |
<div class="p-6"> | |
<div class="flex justify-between items-center mb-4"> | |
<h2 class="text-xl font-semibold text-gray-800"> | |
<i class="fas fa-robot text-purple-500 mr-2"></i>AI Wellness Analysis | |
</h2> | |
<span class="bg-purple-100 text-purple-800 text-xs px-3 py-1 rounded-full">DeepSeek-R1</span> | |
</div> | |
<div id="aiAnalysis" class="space-y-4"> | |
<div class="text-center py-8 text-gray-400"> | |
<i class="fas fa-magic text-3xl mb-2"></i> | |
<p>Analyze your data to get personalized insights</p> | |
</div> | |
</div> | |
<div class="mt-6"> | |
<button id="analyzeBtn" class="w-full bg-purple-600 hover:bg-purple-700 text-white font-medium py-3 px-4 rounded-lg smooth-transition pulse-animation"> | |
<i class="fas fa-bolt mr-2"></i>Run Analysis | |
</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Right Column --> | |
<div class="space-y-6"> | |
<!-- Wellness Summary --> | |
<div class="bg-white rounded-xl shadow-md overflow-hidden smooth-transition card-hover"> | |
<div class="p-6"> | |
<h2 class="text-xl font-semibold text-gray-800 mb-4"> | |
<i class="fas fa-heartbeat text-red-500 mr-2"></i>Wellness Summary | |
</h2> | |
<div class="space-y-4"> | |
<div class="flex items-center"> | |
<div class="w-10 h-10 rounded-full bg-red-100 flex items-center justify-center mr-3"> | |
<i class="fas fa-bed text-red-500"></i> | |
</div> | |
<div> | |
<p class="text-sm text-gray-500">Sleep Quality</p> | |
<p class="font-medium" id="sleepQuality">--</p> | |
</div> | |
</div> | |
<div class="flex items-center"> | |
<div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3"> | |
<i class="fas fa-walking text-blue-500"></i> | |
</div> | |
<div> | |
<p class="text-sm text-gray-500">Activity Level</p> | |
<p class="font-medium" id="activityLevel">--</p> | |
</div> | |
</div> | |
<div class="flex items-center"> | |
<div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3"> | |
<i class="fas fa-utensils text-green-500"></i> | |
</div> | |
<div> | |
<p class="text-sm text-gray-500">Nutrition</p> | |
<p class="font-medium" id="nutrition">--</p> | |
</div> | |
</div> | |
<div class="flex items-center"> | |
<div class="w-10 h-10 rounded-full bg-yellow-100 flex items-center justify-center mr-3"> | |
<i class="fas fa-brain text-yellow-500"></i> | |
</div> | |
<div> | |
<p class="text-sm text-gray-500">Mental Health</p> | |
<p class="font-medium" id="mentalHealth">--</p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Action Items --> | |
<div class="bg-white rounded-xl shadow-md overflow-hidden smooth-transition card-hover"> | |
<div class="p-6"> | |
<h2 class="text-xl font-semibold text-gray-800 mb-4"> | |
<i class="fas fa-tasks text-emerald-500 mr-2"></i>Recommended Actions | |
</h2> | |
<div id="actionItems" class="space-y-3"> | |
<div class="text-center py-8 text-gray-400"> | |
<i class="fas fa-lightbulb text-3xl mb-2"></i> | |
<p>Get personalized recommendations after analysis</p> | |
</div> | |
</div> | |
<div class="mt-4"> | |
<button id="updateNotionBtn" class="w-full bg-emerald-600 hover:bg-emerald-700 text-white font-medium py-3 px-4 rounded-lg smooth-transition"> | |
<i class="fas fa-save mr-2"></i>Update Notion | |
</button> | |
</div> | |
</div> | |
</div> | |
<!-- Status --> | |
<div class="bg-white rounded-xl shadow-md overflow-hidden smooth-transition card-hover"> | |
<div class="p-6"> | |
<h2 class="text-xl font-semibold text-gray-800 mb-4"> | |
<i class="fas fa-info-circle text-blue-500 mr-2"></i>System Status | |
</h2> | |
<div class="space-y-3"> | |
<div class="flex justify-between items-center"> | |
<span class="text-gray-600">Notion Connection</span> | |
<span id="notionStatus" class="px-2 py-1 text-xs rounded-full bg-gray-200 text-gray-800">Disconnected</span> | |
</div> | |
<div class="flex justify-between items-center"> | |
<span class="text-gray-600">API Credits</span> | |
<span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800">100 remaining</span> | |
</div> | |
<div class="flex justify-between items-center"> | |
<span class="text-gray-600">Last Analysis</span> | |
<span id="lastAnalysis" class="px-2 py-1 text-xs rounded-full bg-gray-200 text-gray-800">Never</span> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</main> | |
<!-- Footer --> | |
<footer class="bg-gray-800 text-white py-6"> | |
<div class="container mx-auto px-4"> | |
<div class="flex flex-col md:flex-row justify-between items-center"> | |
<div class="mb-4 md:mb-0"> | |
<p class="text-sm">© 2023 Wellness AI Dashboard. All rights reserved.</p> | |
</div> | |
<div class="flex space-x-4"> | |
<a href="#" class="text-gray-300 hover:text-white smooth-transition"> | |
<i class="fab fa-github"></i> | |
</a> | |
<a href="#" class="text-gray-300 hover:text-white smooth-transition"> | |
<i class="fab fa-twitter"></i> | |
</a> | |
<a href="#" class="text-gray-300 hover:text-white smooth-transition"> | |
<i class="fab fa-discord"></i> | |
</a> | |
</div> | |
</div> | |
</div> | |
</footer> | |
</div> | |
<!-- Notion Connection Modal --> | |
<div id="notionModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden"> | |
<div class="bg-white rounded-xl p-6 w-full max-w-md"> | |
<div class="flex justify-between items-center mb-4"> | |
<h3 class="text-xl font-semibold">Connect to Notion</h3> | |
<button id="closeModalBtn" class="text-gray-400 hover:text-gray-600"> | |
<i class="fas fa-times"></i> | |
</button> | |
</div> | |
<div class="mb-6"> | |
<p class="text-gray-600 mb-4">To connect your Notion workspace, please enter your API key:</p> | |
<input type="password" id="notionApiKey" placeholder="Enter your Notion API key" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> | |
<p class="text-xs text-gray-500 mt-2">We don't store your API key on our servers.</p> | |
</div> | |
<div class="flex justify-end space-x-3"> | |
<button id="cancelConnectBtn" class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 smooth-transition">Cancel</button> | |
<button id="confirmConnectBtn" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 smooth-transition">Connect</button> | |
</div> | |
</div> | |
</div> | |
<script> | |
</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=crazychon/me-ia" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
</html> |