text: import torch
  import random
  import json
  import model
  from nltk_utils import bag_of_words, tokenize
  import torch.nn as nn
  
  
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
  
  with open('data/intents.json', 'r') as json_data:
      intents = json.load(json_data)
  
  path = "saved/data.pth"
  data = torch.load(path)
  
  input_size = data["input_size"]
  hidden_size = data["hidden_size"]
  output_size = data["output_size"]
  all_words = data['all_words']
  tags = data['tags']
  model_state = data["model_state"]
  
  model = model.NeuralNet(input_size, hidden_size, output_size).to(device)
  model.load_state_dict(model_state)
  model.eval()
  
  bot_name = "Billy"
  print(f"Start talking with {bot_name} (type quit to exit)!")
  
  while True:
      sentence = input("You: ")
      if sentence == "quit":
          break
  
      sentence = tokenize(sentence)
      X = bag_of_words(sentence, all_words)
      X = X.reshape(1, X.shape[0])
      X = torch.from_numpy(X).to(device)
  
      output = model(X)
      softmax = nn.Softmax(dim=1)
      output = softmax(output)
      prob, prediction = torch.max(output.data, 1)
      tag = tags[prediction.item()]
  
      if prob.item() > 0.75:
          for intent in intents['intents']:
              if tag == intent["tag"]:
                  print(f"{bot_name}: {random.choice(intent['responses'])}")
      else:
          print(f"{bot_name}: Entendi nada.")
  
  