Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,052 Bytes
e526f7e 4039503 e526f7e ecc5775 1b9ef36 4b3065f 1b9ef36 ac9c772 49b1d7c 1b9ef36 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
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
@spaces.GPU
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()
|