Spaces:
Paused
Paused
| import gradio as gr | |
| import os | |
| import torch | |
| import torchvision | |
| from PIL import Image | |
| import numpy as np | |
| import imageio | |
| import spaces | |
| import subprocess | |
| extensions_dir = "./torch_extension/" | |
| os.environ["TORCH_EXTENSIONS_DIR"] = extensions_dir | |
| def update(name): | |
| from networks.generator import Generator | |
| return f"Welcome to Gradio, {name}!" | |
| # with gr.Blocks() as demo: | |
| # gr.Markdown("Start typing below and then click **Run** to see the output.") | |
| # with gr.Row(): | |
| # inp = gr.Textbox(placeholder="What is your name?") | |
| # out = gr.Textbox() | |
| # btn = gr.Button("Run") | |
| # btn.click(fn=update, inputs=inp, outputs=out) | |
| # demo.launch( | |
| # server_name='0.0.0.0', | |
| # #server_port=7803, | |
| # #server_port=10008, | |
| # share=True, | |
| # allowed_paths=["./data/source","./data/driving"] | |
| # ) | |
| # gr.Interface( | |
| # fn=update, | |
| # inputs=gr.Text(), | |
| # outputs=gr.Text(), | |
| # ).launch() | |
| demo = gr.Interface(fn=update, inputs="textbox", outputs="textbox") | |
| if __name__ == "__main__": | |
| demo.launch() | |