viernes, 31 de agosto de 2018

HTML: Práctica 15

 Mostrar Noticias de IA en Tiempo Real

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Recursos sobre Inteligencia Artificial</title>
    <style>
        /* Estilo básico */
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
        }
        .container {
            display: flex;
            justify-content: space-between;
            margin: 20px;
        }
        .links {
            width: 200px;
            text-align: center;
        }
        .links a {
            display: block;
            margin-bottom: 15px;
            text-decoration: none;
            color: #007BFF;
            font-weight: bold;
        }
        .textarea-container {
            flex-grow: 1;
        }
        textarea {
            width: 100%;
            height: 200px;
            padding: 10px;
            font-size: 14px;
            border-radius: 5px;
            border: 1px solid #ccc;
        }
        .api-container {
            margin-top: 30px;
            text-align: center;
        }
        .api-container input {
            padding: 10px;
            font-size: 16px;
            width: 60%;
            border-radius: 5px;
            border: 1px solid #ccc;
        }
        .api-container button {
            padding: 10px 15px;
            font-size: 16px;
            border-radius: 5px;
            background-color: #007BFF;
            color: white;
            cursor: pointer;
        }
        .api-container button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="links">
        <strong>Recursos sobre IA</strong>
        <nav>
            <a href="https://www.singularityhub.com" target="_blank">Inteligencia Artificial: Hub de la Singularidad</a>
            <a href="https://openai.com" target="_blank">OpenAI</a>
            <a href="https://www.coursera.org/courses?query=artificial%20intelligence" target="_blank">Cursos sobre IA (Coursera)</a>
        </nav>
    </div>

    <div class="textarea-container">
        <textarea id="cuadro" rows="8" cols="30" placeholder="Elige un enlace para obtener mas informacion..."></textarea>
    </div>
</div>

<!-- Sección API: Respuestas sobre IA -->
<div class="api-container">
    <h2>Haz una pregunta sobre Inteligencia Artificial</h2>
    <input type="text" id="userQuestion" placeholder="Escribe tu pregunta sobre IA..." />
    <button onclick="getAIResponse()">Obtener Respuesta</button>
    <div id="responseArea"></div>
</div>

<script>
    // Cambiar el contenido del textarea según el enlace sobrevolado
    function escribe(frase) {
        document.getElementById('cuadro').value = frase;
    }

    document.querySelectorAll('.links a').forEach(link => {
        link.addEventListener('mouseover', function() {
            let description = '';
            switch (link.textContent) {
                case 'Inteligencia Artificial: Hub de la Singularidad':
                    description = 'Articulos sobre IA y su impacto en el futuro.';
                    break;
                case 'OpenAI':
                    description = 'Plataforma lider en investigacion sobre IA, incluyendo modelos como GPT-4.';
                    break;
                case 'Cursos sobre IA (Coursera)':
                    description = 'Accede a cursos de IA en Coursera desde nivel principiante hasta avanzado.';
                    break;
            }
            escribe(description);
        });
    });

    // Simulando una llamada API (para demostración)
    function getAIResponse() {
        const question = document.getElementById('userQuestion').value;
        if (question.trim() === '') {
            alert("Por favor, escribe una pregunta.");
            return;
        }
        // Aquí se podría hacer una llamada real a una API de IA, como OpenAI.
        // Por ahora, simula una respuesta estática:
        const response = `Respuesta sobre IA a la pregunta: "${question}"\n\n(Respuesta simulada: IA esta en constante evolucion y sus aplicaciones son infinitas. Actualmente se usa en áreas como la salud, la educacion, y la automoción. ¡El futuro es prometedor!)`;
        document.getElementById('responseArea').innerText = response;
    }
</script>

</body>
</html>
 

 

 

No hay comentarios.:

Publicar un comentario