import streamlit as st from transformers import pipeline # Carica il modello AI @st.cache_resource def load_model(): return pipeline("text-generation", model="ibm-granite/granite-3.2-2b-instruct") chatbot = load_model() # UI del sito st.title("💬 Chatbot AI") st.write("Scrivi un messaggio e il chatbot risponderà!") # Input utente user_input = st.text_input("Tu:", "") if st.button("Invia"): if user_input: response = chatbot(user_input, max_length=200, do_sample=True) st.text_area("Chatbot:", response[0]["generated_text"], height=200)