def writeHTML(options): from html import HTML titles = options.titles h = HTML('html') h.p('Results') h.br() path = '.' #methods = ['planenet', 'pixelwise', 'pixelwise+RANSAC', 'GT+RANSAC', 'planenet+crf', 'pixelwise+semantics+RANSAC'] #methods = ['planenet', 'pixelwise', 'pixelwise+RANSAC', 'GT+RANSAC'] for image_index in xrange(options.numImages): t = h.table(border='1') r_inp = t.tr() r_inp.td('input ' + str(image_index + options.startIndex)) r_inp.td().img(src=path + '/' + str(image_index + options.startIndex) + '_image.png') r = t.tr() r.td('methods') for method_index, method in enumerate(titles): r.td(method) continue r = t.tr() r.td('segmentation') for method_index, method in enumerate(titles): r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_segmentation_pred_' + str(method_index) + '.png') r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_segmentation_pred_blended_' + str(method_index) + '.png') continue r = t.tr() r.td('depth') for method_index, method in enumerate(titles): r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_depth_pred_' + str(method_index) + '.png') continue h.br() continue metric_titles = ['depth error 0.1', 'depth error 0.2', 'depth error 0.3', 'IOU 0.3', 'IOU 0.5', 'IOU 0.7'] h.p('Curves on plane accuracy') for title in metric_titles: h.img(src='curve_plane_' + title.replace(' ', '_') + '.png') continue h.p('Curves on pixel coverage') for title in metric_titles: h.img(src='curve_pixel_' + title.replace(' ', '_') + '.png') continue html_file = open(options.test_dir + '/index.html', 'w') html_file.write(str(h)) html_file.close() return
def writeHTML(options): from html import HTML titles = options.titles h = HTML('html') h.p('Results') h.br() path = '.' #methods = ['planenet', 'pixelwise', 'pixelwise+RANSAC', 'GT+RANSAC', 'planenet+crf', 'pixelwise+semantics+RANSAC'] #methods = ['planenet', 'pixelwise', 'pixelwise+RANSAC', 'GT+RANSAC'] for image_index in range(options.numImages): t = h.table(border='1') r_inp = t.tr() r_inp.td('input ' + str(image_index + options.startIndex)) r_inp.td().img(src=path + '/' + str(image_index + options.startIndex) + '_image.png') # r = t.tr() # r.td('PlaneNet prediction') # r.td().img(src=firstFolder + '/' + str(index) + '_segmentation_pred.png') # r.td().img(src=firstFolder + '/' + str(index) + '_depth_pred.png') r = t.tr() r.td('methods') for method_index, method in enumerate(titles): r.td(method) continue r = t.tr() r.td('segmentation') for method_index, method in enumerate(titles): r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_segmentation_pred_' + str(method_index) + '.png') r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_segmentation_pred_blended_' + str(method_index) + '.png') continue r = t.tr() r.td('depth') for method_index, method in enumerate(titles): r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_depth_pred_' + str(method_index) + '.png') continue h.br() continue metric_titles = [ 'depth error 0.1', 'depth error 0.2', 'depth error 0.3', 'IOU 0.3', 'IOU 0.5', 'IOU 0.7' ] h.p('Curves on plane accuracy') for title in metric_titles: h.img(src='curve_plane_' + title.replace(' ', '_') + '.png') continue h.p('Curves on pixel coverage') for title in metric_titles: h.img(src='curve_pixel_' + title.replace(' ', '_') + '.png') continue html_file = open(options.test_dir + '/index.html', 'w') html_file.write(str(h)) html_file.close() return
tier += 1 for ID in t: i = gw.getItemData(ID) newItem = mat(i['name'], i['sale_availability'], i['offer_availability'], ID, i['min_sale_unit_price'], i['max_offer_unit_price'], i['sale_price_change_last_hour'], i['offer_price_change_last_hour'], tier) items[ID] = newItem # Generate HTML page = HTML('html') tier = 0 for t in tierMats: tier += 1 page.br() page.br() table = page.table(border='1') table.thead.th("Tier %d" % tier, colspan='3') head = table.thead() for s in ['Name','Min sell', 'Max buy']: head.th(s) for ID in t: tr = table.tr() for data in [items[ID].name, items[ID].sellPrice, items[ID].buyPrice]: tr.td(str(data)) print "Content-type: text/html\n" print page
from email.header import Header from email.mime.multipart import MIMEMultipart import traceback from html import HTML import pdb # 设置css样式 inline_css = { 'black': 'color:#000000;', 'red': 'color:#FF0000;', 'green': 'color:#00FF00;', } b = HTML() b1 = b.br("这是表格1:") t1 = b.table(border='1', caption='table 1', width='800') with open('market_monitor_1.csv') as f: lines = f.readlines() for line in lines: datas = line.split('\t') r1 = t1.tr() r1.td(datas[0], style=inline_css['black']) r1.td(datas[1], style=inline_css['black']) r1.td(datas[2], style=inline_css['black']) r1.td(datas[3], style=inline_css['black']) r1.td(datas[4], style=inline_css['black']) r1.td(datas[5], style=inline_css['black']) r1.td(datas[6], style=inline_css['black']) r1.td(datas[7], style=inline_css['black'])