Spaces:
Build error
Build error
File size: 1,209 Bytes
fbfe110 d82945a 3b85876 fbfe110 3b85876 112da35 fbfe110 d82945a fbfe110 112da35 fbfe110 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import streamlit as st
from transformers import pipeline
# Cargar el modelo de DeepSeek AI para el chatbot
@st.cache_resource
def load_model():
model_name = "deepseek-ai/DeepSeek-R1" # Cambia esto si el modelo es diferente
# Usar la tarea 'text-generation' en lugar de 'conversational'
chatbot = pipeline("text-generation", model=model_name, trust_remote_code=True)
return chatbot
# Inicializa el modelo
chatbot = load_model()
def main():
# T铆tulo de la aplicaci贸n
st.title("ChatBot - DeepSeek AI")
# Introducci贸n
st.write("隆Bienvenido al ChatBot! Puedes hacerle preguntas y recibir respuestas.")
# Campo de entrada de texto
user_input = st.text_input("Escribe tu pregunta:", "")
if user_input:
# Generar una respuesta del chatbot usando el modelo
response = chatbot(user_input, max_length=100, num_return_sequences=1)
# Mostrar la respuesta generada
st.write(f"**Respuesta del chatbot:** {response[0]['generated_text']}")
# Bot贸n para reiniciar el chat (opcional)
if st.button("Reiniciar chat"):
st.write("Chat reiniciado. Puedes comenzar de nuevo.")
if __name__ == "__main__":
main() |