コード例 #1
0
 def GET(self):
 	user_data=web.input()
 	text=' '.join(user_data.values())
 	text=tag.remove_address_info(text)
 	word_freq=tag.calculate_all_text_freq(text)
 	category=predict_CPN(word_freq)
     return category
コード例 #2
0
	def GET(self):
		user_data=web.input()
		text=' '.join(user_data.values())
		text=tag.remove_address_info(text)
		word_freq=tag.calculate_all_text_freq(text)
		category,desc=predict_CPN(word_freq)
		img_file='static/img/'+category+'.jpg'
		cpn='Component Number: '+category
		pyDict={"CPN":cpn,"img_file":img_file,"DESC":desc}
		web.header('Content-Type','application/json')
		return json.dumps(pyDict)