2019-03-02 11:21:56 +08:00
|
|
|
from argparse import ArgumentParser
|
|
|
|
import gradio
|
|
|
|
|
|
|
|
parser = ArgumentParser(description='Arguments for Building Interface')
|
|
|
|
parser.add_argument('-i', '--inputs', type=str, help="name of input interface")
|
|
|
|
parser.add_argument('-o', '--outputs', type=str, help="name of output interface")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
def launch_interface(args):
|
|
|
|
io = gradio.Interface(inputs=args.inputs, outputs=args.outputs, model=lambda x:x, model_type='function')
|
|
|
|
io.launch()
|
2019-03-02 12:13:02 +08:00
|
|
|
# input_interface = gradio.inputs.registry[args.inputs.lower()]()
|
|
|
|
# output_interface = gradio.outputs.registry[args.outputs.lower()]()
|
|
|
|
# temp_dir = tempfile.mkdtemp()
|
|
|
|
# gradio.networking.build_template(temp_dir, input_interface, output_interface)
|
|
|
|
# print('Open this path in your browser to access the input interface: {}'.format(
|
|
|
|
# os.path.join(temp_dir, INDEX_FILE_NAME)))
|
2019-03-02 11:21:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
launch_interface(args)
|