In [16]:
import requests
import pprint
from IPython.display import Image, SVG
# This is your service IP address. You need to modify this!
BASE = 'http://52.40.167.60:5000/'
# Helper function to POST a local CX file
def post_file(url, file_name):
with open(file_name, 'r') as f:
return requests.post(url, data=f)
# Check server is actually working
res = requests.get(BASE)
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(res.json())
In [17]:
bitmap_image_url = BASE + 'image'
res = post_file(bitmap_image_url, './gal_filtered_2.json')
Image(data=res.content)
Out[17]:
In [12]:
# Test Bel Network
res = post_file(bitmap_image_url, 'asCX2.json')
Image(data=res.content)
In [4]:
svg_image_url = BASE + 'image/svg'
res = post_file(svg_image_url, 'gal_filtered_2.json')
# print(res.content)
SVG(data=res.content)
Out[4]:
In [5]:
svg_image_url = BASE + 'image/graphviz/svg'
res = post_file(svg_image_url, 'gal_filtered_2.json')
SVG(data=res.content)
Out[5]: