gradio/build-interface.py

23 lines
925 B
Python
Raw Normal View History

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()
# 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)))
if __name__ == "__main__":
launch_interface(args)