Exemplo n.º 1
0
def start_demo():
    if not records:
        tkMessageBox.showerror("错误", "请先生成记录")
        return

    d = demo.Demo(records)
    d.run()
Exemplo n.º 2
0
def gen_answer(question, top5sents, category):
    review = ""
    for s in top5sents:
        review += s + ". "
    d = demo.Demo(category)
    res = d.predict(question, review)
    return res
Exemplo n.º 3
0
def init():
    global TP
    TP = ThreadPoolExecutor(max_workers=10)
    
    global NAME, PNAME, GAME, PAUSE
    NAME = 'Fallout3'
    PNAME = 'Fallout3.exe'
    GAME = game.Game(PNAME)
    PAUSE = True
    
    global CMD,MAXMULT
    CMD = cmds.CmdProc()
    MAXMULT = 5
    
    global M_DEMO,M_MENU,M_DELAY,M_PAUSES
    M_DEMO = mode.Mode(True,0,100,65,1,-1,['order','demo','democracy'],['chaos','anarchy'])
    M_MENU = mode.Mode(False,0,100,45,1,-1,['banm','banmenu','bm','bmnu'],['unbanm','unbanmenu','unbm','unbmnu'])
    M_DELAY = mode.Mode(True,30,60,30,0.5,-0.5,['delayup','dlyup','dup'],['delaydn','dlydn','dlydown','delaydown','ddn','ddown'])
    M_PAUSES = mode.Mode(False,0,100,25,1,-1,['pause'],['nopause'])
    
    global MODES
    MODES = mode.Modes([M_DEMO,M_MENU,M_DELAY,M_PAUSES])
    
    global LB_CHAT,LB_CMDS,LB_VOTE
    LB_CHAT=listb.Lb(10,30)
    LB_CMDS=listb.Lb(10,20)
    LB_VOTE=listb.Lb(6,10)
    
    global DEMO
    DEMO = demo.Demo(M_DELAY,LB_VOTE)

    global ST_HP,ST_LVL,ST_DEATHS
    ST_HP=mem.Stat('Health',0x137D8B8,0x2cc)
    ST_LVL=mem.Stat('Level',0x137D8B8,0x208)
    ST_DEATHS=mem.Stat('Deaths',0x1378700,0x5c)
    
    global STATS
    STATS = mem.Stats([ST_HP,ST_LVL,ST_DEATHS])
    
    global CON
    CON=0
    
    global IRC_SERVER,IRC_PORT,IRC_CHANNEL,IRC_NICK,IRC_OAUTH,IRC_RECON
    IRC_SERVER = "irc.twitch.tv"
    IRC_PORT = 6667
    IRC_CHANNEL = "#twitchplaysfallouts"
    IRC_NICK = "TP_Fallout_Mod"
    IRC_OAUTH = "oauth:v505nbpf3ntf4451o5h0le1qqmrbmy"
    IRC_RECON = 1
Exemplo n.º 4
0
    def __init__(self):
        self.d = demo.Demo()

        # callback =
        self.d.registerFunc(self.testFunc)
Exemplo n.º 5
0
import demo

if __name__ == '__main__':
    plt.switch_backend('agg')
    parser = argparse.ArgumentParser()
    parser.add_argument("--im_path", type=str, help="path_to_image")
    cfg = parser.parse_args()

    assert os.path.exists(cfg.im_path)

    imid = cfg.im_path.split('/')[-1].split('.')[0]
    save_path = os.path.join('./images', imid + '_ncuts_result.png')

    ckpt_path = './ckpt/exif_final/exif_final.ckpt'
    exif_demo = demo.Demo(ckpt_path=ckpt_path,
                          use_gpu=0,
                          quality=3.0,
                          num_per_dim=30)

    print('Running image %s' % cfg.im_path)
    ms_st = time.time()
    im_path = cfg.im_path
    im1 = skio.imread(im_path)[:, :, :3].astype(np.float32)
    res = exif_demo.run(im1, use_ncuts=True, blue_high=True)
    print('MeanShift run time: %.3f' % (time.time() - ms_st))

    plt.subplots(figsize=(16, 8))
    plt.subplot(1, 3, 1)
    plt.title('Input Image')
    plt.imshow(im1.astype(np.uint8))
    plt.axis('off')
Exemplo n.º 6
0
 str_filter_name = arg_in.fname
 if bol_okay:
     log.info("{} {} {} {} ...running...".format(
         arg_in.command, str_filter_do, str_filter_name,
         arg_in.fdetails))
     # Load Register
     reg_sc = sc_register.Register()  # Build empty register
     reg_sc.read_from_file()  # read data from standard filename
     # Load Filter
     ftr_selected = None
     if str_filter_name == 'karma':
         ftr_selected = karma.Karma()
     elif str_filter_name == 'bw':
         ftr_selected = bw.BW()
     elif str_filter_name == 'demo':
         ftr_selected = demo.Demo()
     # Parse Register through Filter
     if ftr_selected:
         log.info("Found filter: {}".format(
             ftr_selected.filter_name))
         reg_sc = ftr_selected.filter(reg_sc)
         log.info("{} Done...".format(arg_in.command))
         # Only for bebug XXX
         #for scmail in reg_sc.list_all():
         #    print("{} : {}".format(reg_sc.get(scmail).get_shorthand(), reg_sc.get(scmail).get_spamlevel()))
         reg_sc.write_to_file()
         log.info("{} {} e-mails Done...".format(
             arg_in.command, reg_sc.count()))
     else:
         log.warning(
             "The filename was not matched by any filer: {}".format(
Exemplo n.º 7
0
def main():
    hikingLog = HikingLog.HikingLog().get()
    dem = demo.Demo(hikingLog)
    dem.startDemo()
Exemplo n.º 8
0

def f1(output, mask, eps=1e-6):
    # <-- the name image is not professional
    # <-- img need to be rounded before calculating
    output = output.round()
    TP = np.sum(output * mask)
    FP = np.sum(output * (1.0 - mask))
    FN = np.sum((1.0 - output) * mask)
    f1_val = (2 * TP + eps) / (2 * TP + FN + FP + eps)
    return f1_val


ckpt_path = './ckpt/exif_final/exif_final.ckpt'
exif_demo = demo.Demo(ckpt_path=ckpt_path,
                      use_gpu=[0],
                      quality=2.0,
                      num_per_dim=10)
path_dataset = "dataset"
datasets = ["RT", "Columbia"]  # <-- it should be datasets = [...]
for dataset in datasets:  # <-- it should be for dataset in datasets
    # Collect paths
    # au_path_images = os.path.join(path_dataset, dataset, "au/images")
    # au_images = [os.path.join(au_path_images, f ) for f in os.listdir(au_path_images)]

    # tp_path_images = os.path.join(path_dataset, dataset, "tp/images")
    # tp_images = [os.path.join(tp_path_images, f ) for f in os.listdir(tp_path_images)]

    # masks_path = os.path.join(path_dataset, dataset, "tp/labels")
    # masks = [os.path.join(masks_path, f ) for f in os.listdir(masks_path)]      # <-- Ensure that tp_images and masks are in the same order

    # # Alternative for collecting paths
Exemplo n.º 9
0
#coding: utf-8
import demo
print "test 包下的init文件"
mDemo = demo.Demo()