4. Modules in Python
• Use multiple functions written by others
• Popular packages: json, requests
• How do you tell python to use these packages?
5. JSON Module
• JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
6. 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
7. • JSON (JavaScript Object Notation)
• A very popular format to transmit and receive data over web
• What would the json dump of a dictionary be?
JSON Module
8. • 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?
JSON Module
9. • 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
JSON Module
10. • This module helps you to send HTTP requests in python
• What are HTTP requests?
Requests Module in Python
11. • This module helps you to send HTTP requests in python
• How to use HTTP requests to interact with an AI?
Requests Module in Python
12. • 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)
Requests Module in Python
13. • 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”}
Requests Module in Python
14. • Login to your Navigator accounts and select the mood AI
Lets connect your AI with Python
15. • Login to your Navigator accounts and select the mood AI
• Click on the integration tab in the monitor tab
Lets connect your AI with Python
16. • 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
Lets connect your AI with Python
17. • 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
Lets connect your AI with Python
18. • 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
Lets connect your AI with Python
19. • 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
Lets connect your AI with Python
20. • 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
Lets connect your AI with Python
21. • Build a python application powered by AI
• Examples
• Chatbot
• Games
• Tanks and bots
• Black jack
Think about your projects