text stringlengths 0 93.6k |
|---|
if text: |
return generate_audio_response(text, speaker_id) |
else: |
return {} |
@app.route('/js/<path:path>') |
def send_js(path): |
return send_from_directory( |
os.path.join(static_path, 'js'), path) |
@app.route('/css/<path:path>') |
def send_css(path): |
return send_from_directory( |
os.path.join(static_path, 'css'), path) |
@app.route('/audio/<path:path>') |
def send_audio(path): |
return send_from_directory( |
os.path.join(static_path, 'audio'), path) |
if __name__ == '__main__': |
parser = argparse.ArgumentParser() |
parser.add_argument('--load_path', required=True) |
parser.add_argument('--checkpoint_step', default=None, type=int) |
parser.add_argument('--num_speakers', default=1, type=int) |
parser.add_argument('--port', default=5000, type=int) |
parser.add_argument('--debug', default=False, type=str2bool) |
config = parser.parse_args() |
if os.path.exists(config.load_path): |
prepare_dirs(config, hparams) |
global_config = config |
synthesizer.load(config.load_path, config.num_speakers, config.checkpoint_step) |
else: |
print(" [!] load_path not found: {}".format(config.load_path)) |
app.run(host='0.0.0.0', port=config.port, debug=config.debug) |
# <FILESEP> |
import os |
import re |
import sys |
import click |
import struct |
from termcolor import colored, cprint |
from triton import * |
# Import module from current directory |
SYMBOLICFILE = os.path.abspath(os.path.expanduser(__file__)) |
sys.path.insert(0, os.path.dirname(SYMBOLICFILE)) |
from singleton import Singleton |
TritonContext = TritonContext() |
astCtxt = TritonContext.getAstContext() |
def parse_arg(arg): |
return map(lambda x: x.encode("ascii"), arg.split()) |
class Arch(Singleton, object): |
def __init__(self): |
if (self._initialized): |
return |
pointer_byte = {'amd64': 8, 'i386': 4} |
reg_bits = {'amd64': 64, 'i386': 32} |
struct_format = {'amd64': '<Q', 'i386': '<I'} |
triton_arch = {'amd64': ARCH.X86_64, 'i386': ARCH.X86} |
pc_reg = {'amd64': 'rip', 'i386': 'eip'} |
self.arch = self.get_arch() |
self._initialized = True |
self.pointer_byte = pointer_byte[self.arch] |
self.reg_bits = reg_bits[self.arch] |
self.struct_format = struct_format[self.arch] |
self.triton_arch = triton_arch[self.arch] |
TritonContext.setArchitecture(self.triton_arch) |
self.triton_pc_reg = getattr(TritonContext.registers, |
pc_reg[self.arch]) |
self.pc_reg = pc_reg[self.arch] |
def get_arch(self): |
filedata = open(GdbUtil().file, "rb").read(0x800) |
# Linux binaries |
if filedata[0:4] == b"\x7FELF": |
# get file type |
fb = struct.unpack("H", filedata[0x12:0x14])[0] # e_machine |
if fb == 0x3e: |
return "amd64" |
elif fb == 0x03: |
return "i386" |
else: |
raise Exception("binary type " + hex(fb) + " not supported") |
return None |
class GdbUtil(Singleton, object): |
def __init__(self): |
if (self._initialized): |
return |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.