Пример #1
0
'''

import json, os, cv2, sys, time
import tensorflow as tf
from flask import Flask, request
from pathlib import Path

sys.path.append('..')
from color import Colored as C
# from model import UNET as G
import numpy as np

# import config as cf
os.environ['CUDA_VISIBLE_DEVICES'] = ''

print_ = lambda x: print(C.blue(f"--> [{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}]: {x}"))


def handle(dic_url, model_path, saved_dir, sr_or_os):
    if sr_or_os == 'sr':
        from model import UNET_sr as G
    elif sr_or_os == 'os':
        from model import UNET_os as G
    else:
        print('inference.py: line 25, [sr_or_os] must be "sr" or "os".')
        exit()

    print('\n')
    print('-' * 50)
    print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
Пример #2
0
print_ = lambda x: print(
    f"--> [{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}]: {x}"
)


def handle():
    print('\n')
    print('-' * 50)
    print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))

    sk = socket.socket()
    ip = '127.0.0.1'
    port = 10005
    sk.bind((ip, port))
    sk.listen(10)
    while True:
        new_cil, addr = sk.accept()
        print(f'new addr:{addr}')
        print(new_cil.recv(1024).decode())
        new_cil.send(b'huixin haha')
        new_cil.send(b'zai huixin hahaha')
        new_cil.close()


if __name__ == '__main__':
    # handle()
    print_ = lambda x: print(f'\033[1;32;0m{x}\033[0m')
    print_('nihaoma beijing?')
    print('\033[1;32;0mnihaoma beijing?\033[0m')
    print(C.blue('nihaoma beijing?'))