bottle创建python的rest接口
来源:互联网 发布:淘宝微博运营团队 编辑:程序博客网 时间:2024/04/30 00:29
# -*- coding: utf-8 -*-"""Created on Wed Nov 15 16:00:06 2017@author: ESRI"""from PIL import Imageimport numpy as npimport pandas as pd from sklearn.externals import joblibfrom bottle import route, run, template@route('/hello/<name>')def index(name): file='E:\\python\\kaggle\\DigitRecognizer\\picture\\picture'+ name + '.jpg' pixel_lists = [] print 'file path is:' print file img = Image.open(file) img = img.convert("L") print img img = img.resize((28, 28)) print img.size img_array = np.asarray(img) print type(img_array) print img_array vec = img_array.reshape(1,784) print vec pixel_lists.append(vec[0]) columns = ['pixel'+ str(s) for s in range(0,784)] df = pd.DataFrame(pixel_lists,columns=columns) #print df.describe() print df.values clf1 = joblib.load("E:\\python\\kaggle\\DigitRecognizer\\train_model.m") print clf1 result = clf1.predict(df.values) print result[0] #return result[0] return "success_jsonpCallback(" + str(result[0]) + ");" run(host='localhost', port=8088)
阅读全文
0 0
- bottle创建python的rest接口
- 很好用的Python框架Bottle
- bottle 接口实例
- Python web frame:Bottle
- python bottle json 返回
- python bottle 简介
- 解决基于BAE python+bottle开发上的一系列问题
- Python --bottle/django web framwork 环境的搭建
- Python使用Bottle来提供一个简单的web服务
- python bottle 搭建最简单的 web服务器
- 百度语音REST接口使用(python)
- ArcGIS Server的REST接口
- ElasticSearch下的REST接口
- FHIR的REST接口形式
- Neo4j的Rest接口使用
- LR接口测试REST的接口
- 创建REST SOE的schema
- 创建博客-REST的资源
- 协调器断电之后再上电,终端设备不能入网的问题
- hdu 4045 第二类Stirling数
- python统计大小写字符出现的个数
- nyoj 284 坦克大战(BFS)
- 改变keras模型参数来提高kaggle手写体数字识别
- bottle创建python的rest接口
- java web的简单分页
- jsp+servlet开发小型商城日志
- 数字图像处理--算术、几何、谐波、逆谐波均值滤波器Matlab
- java调用python脚本
- android开发 点击按钮弹出对话框的简单实现
- TensorFlow实战2:实现多项式回归
- 谈谈技术选型的注意事项
- 【量化小讲堂-Python&Pandas系列16】布林带策略在A股的实证