3. Modules in python
• Use multiple functions written by others
• Popular packages: json, requests
• How do you tell python to use these packages?
4. JSON module
• JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
5. JSON module
• JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
• How does it work in python?
• A json is a string
6. JSON module
• JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
• What would the json dump of a dictionary be?
7. JSON module
• JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
• How does it work in python?
• Can any type of variable be dumped? Strings? Lists?
8. JSON module
• JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
• How does it work in python?
• Load a json variable
9. Requests module in python
• This module helps you to send HTTP requests in python
• What are HTTP requests?
10. Requests module in python
• This module helps you to send HTTP requests in python
• How to use HTTP requests to interact with an AI?
11. Requests module in python
• This module helps you to send HTTP requests in python
• How to use HTTP requests to interact with an AI?
url: The http url to send request to
data: String containing the payload (features in case of AI)
12. Requests module in python
• This module helps you to send HTTP requests in python
• How to use HTTP requests to interact with an AI?
Example:
data: {“Sentence”: “I am sad”}
13. Lets connect your AI with python
• Login to your Navigator accounts and select the mood AI
14. Lets connect your AI with python
• Login to your Navigator accounts and select the mood AI
• Click on the integration tab in the monitor tab
15. Lets connect your AI with python
• Login to your Navigator accounts and select the mood AI
• Click on the integration tab in the monitor tab
• Select python from the drop down for connectors
16. Lets connect your AI with python
• Login to your Navigator accounts and select the mood AI
• Click on the integration tab in the monitor tab
• Select python from the drop down for connectors
• Copy paste the code into your repl account
17. Lets connect your AI with python
• Login to your Navigator accounts and select the mood AI
• Click on the integration tab in the monitor tab
• Select python from the drop down for connectors
• Copy paste the code into your repl account
18. Lets connect your AI with python
• Copy paste the code into your repl account
• Note that the code is a function, you have to call this function to get
the prediction
json.dumps() converts
dictionary to striing
Convert the output you
receive into readable format
19. Lets connect your AI with python
• Login to your Navigator accounts and select the mood AI
• Click on the integration tab in the monitor tab
• Select python from the drop down for connectors
• Copy paste the code into your repl account
• Upload the mood dataset into repl
20. Think about your projects
• Build a python application powered by AI
• Examples
• Chatbot
• Games
• Tanks and bots
• Black jack