Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

{
"name": "pai_demo_app",
"processor_entry": "./app.py",
"processor_type": "python",
"processor_path": "oss://eas-model-singpore/<your_user_id>/processor.tar.gz",
"data_image": "registry-intl.ap-southeast-1.aliyuncs.com/<your_repository_name>/eas-demo-image",
"metadata": {
"region": "ap-southeast-1",
"instance": 1,
"memory": 16,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import cv2 as cv
import requests
import os
# Request info
url = "<EAS service URL>"
token = "<EAS service token>"
headers = { 'Authorization' : token }
# Image data
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MNIST Flask app</title>
</head>
<body>
<h1>MNIST image classifier</h1>
<form id="upload-form" action="{{ url_for('upload_and_predict') }}" method="POST" enctype="multipart/form-data">
from flask import Flask, render_template, url_for, request
import os
import requests
import cv2 as cv
app = Flask(__name__)
eas_url = "<EAS service URL>"
token = "EAS service token"
# -*- coding: utf-8 -*-
import allspark
import tensorflow as tf
import cv2 as cv
import numpy as np
import math
import os
import mnist_util
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import cv2 as cv
import numpy as np
import math
def _pad(img):
""" Pad input image to get square image. """
(h, w) = img.shape
if w > h:
diff = w - h
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.