|
import streamlit as st |
|
from datasets import load_dataset |
|
from transformers import pipeline |
|
|
|
|
|
st.title("Chatbot y Análisis de Criptomonedas con Hugging Face") |
|
|
|
|
|
chatbot = pipeline("conversational", model="ITG/DialoGPT-medium-spanish-chitchat") |
|
|
|
|
|
st.header("Chat con el Bot") |
|
user_input = st.text_input("Escribe tu mensaje para el chatbot:") |
|
if st.button("Enviar al Bot"): |
|
if user_input: |
|
response = chatbot(user_input) |
|
st.write(f"Bot: {response[0]['generated_text']}") |
|
else: |
|
st.write("Por favor, escribe un mensaje para el chatbot.") |
|
|
|
|
|
|
|
|
|
st.header("Análisis de Criptomonedas") |
|
st.write(""" |
|
Este análisis se realiza con el conjunto de datos `crypto_data` de Hugging Face para el análisis histórico de precios de criptomonedas. |
|
""") |
|
|
|
|
|
crypto_question = st.text_input("Pregunta sobre criptomonedas (Ej. ¿Qué está pasando con Bitcoin?):") |
|
if st.button("Consultar Criptomonedas"): |
|
if crypto_question: |
|
st.write("Consultando sobre criptomonedas...") |
|
|
|
|
|
crypto_data = load_dataset("sebdg/crypto_data", "candles") |
|
|
|
|
|
st.write("Dataset de Criptomonedas cargado:") |
|
st.write(crypto_data['train'].head()) |
|
|
|
|
|
|
|
else: |
|
st.write("Por favor, escribe tu pregunta sobre criptomonedas.") |
|
|
|
|
|
st.header("Mejora de Interacción con Chatbot") |
|
st.write(""" |
|
El siguiente dataset ayuda a hacer las interacciones del bot más naturales y personalizadas. |
|
""") |
|
|
|
|
|
persona_chat = load_dataset("persona-chat") |
|
|
|
|
|
st.write("Ejemplo de Conversación de Persona Chat:") |
|
st.write(f"Pregunta: {persona_chat['train'][0]['conversation']}") |
|
st.write(f"Respuesta: {persona_chat['train'][0]['personality']}") |
|
|