Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import json
  5. from watson_developer_cloud import ConversationV1
  6.  
  7. conversation = ConversationV1(
  8.     username='b6ddccfd-c4c0-4e20-a239-0ff76ee51461',
  9.     password='S1iYFCciJ2q7',
  10.     version='2017-05-26'
  11.     )
  12.  
  13. # Replace with the context obtained from the initial request
  14. context = {
  15.         'name': 'Tomas',
  16.         'concepts': '83603693',
  17.         #'conversation_id': '453b92e4-f0c6-42e7-8fe4-b3bc7b7e7052',
  18.         'amount': '300.000'
  19.         }
  20.  
  21. workspace_id = 'f2ffb6d2-391b-4f23-9a8b-be9e1153e5c0'
  22.  
  23. response = conversation.message(
  24.     workspace_id=workspace_id,
  25.     message_input=None,
  26.     context=context
  27.     )
  28.  
  29. #print(json.dumps(response, indent=2))
  30. print response['output']['text']
  31.  
  32. while True:
  33.     text_input = raw_input('SAY: ')
  34.     response = conversation.message(
  35.             workspace_id=workspace_id,
  36.             message_input={'text': text_input},
  37.             context=context
  38.             )
  39.     #print(json.dumps(response, indent=2))
  40.     print response['output']['text']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement