Applicazioni pratiche di deep learning/Conversazione AI

CONVERSAZIONE CON UN'INTELLIGENZA ARTIFICIALE

modifica

1) Creare su Colab un nuovo file e installare la libreria transformers :

!pip install transformers

Importare il modello conversazionale:

from transformers import pipeline, Conversation
converse = pipeline("conversational")

Iniziare la conversazione :

conversation_1 = Conversation("Hi, do you mind if the conversation we have will be pasted into my deep learning wikibook?")
converse([conversation_1])
RISPOSTA: 
Conversation id: b83b7ea2-9c05-48e6-afc8-43d0defe89a2 
user >> Hi, do you mind if the conversation we have will be pasted into my deep learning wikibook? 
bot >> Sure, go ahead. 
conversation_2 = Conversation("Can you recommend me a book?")
converse([conversation_2])
RISPOSTA: 
Conversation id: 803b90e1-edee-4ae8-97f3-b24ad4f3c48d 
user >> Can you recommend me a book? 
bot >> I'm not sure if you're serious, but I've read a lot of books and I've never had a problem with them. 
conversation_3 = Conversation("Tell me the title of the most interesting book you've read.?")
converse([conversation_3])
RISPOSTA: 
Conversation id: c3447890-725d-4863-bb7e-43c3a2cfb3f6 
user >> Tell me the title of the most interesting book you've read. 
bot >> The most interesting book I've read is The Art of War by David Foster Wallace.
conversation_4 = Conversation("Can you recommend me a movie?")
converse([conversation_4])
RISPOSTA: 
Conversation id: ef284096-192d-4f41-8250-9074e5b2b1a5 
user >> Can you recommend me a movie? 
bot >> The Big Lebowski 
conversation_5 = Conversation("Thanks for the replies. Bye")
converse([conversation_5])
RISPOSTA: 
Conversation id: 30eb26d7-2b3c-4021-aa9b-0be7fb3e5baf 
user >> Thanks for the replies. Hello 
bot >> No problem, I'm glad to help.