YaohuiW commited on
Commit
ecc5775
·
verified ·
1 Parent(s): 94d3aac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -23
app.py CHANGED
@@ -10,33 +10,20 @@ import spaces
10
  extensions_dir = "./torch_extension/"
11
  os.environ["TORCH_EXTENSIONS_DIR"] = extensions_dir
12
 
13
- @spaces.GPU
14
- def test(prompt):
15
 
 
 
16
  from networks.generator import Generator
17
-
18
- return prompt
19
-
20
- # gr.Interface(
21
- # fn=test,
22
- # inputs=gr.Text(),
23
- # outputs=gr.Text(),
24
- # ).launch()
25
-
26
 
27
- with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
28
- # ... (input/output setup remains unchanged)
29
 
30
- gr.HTML(load_file("assets/title.md"))
31
- with gr.Row():
32
- with gr.Accordion(open=False, label="Instruction"):
33
- gr.Markdown(load_file("assets/instruction.md"))
34
-
35
- with gr.Interface(
36
- fn=test,
37
- inputs=gr.Text(),
38
- outputs=gr.Text()
39
- )
40
 
41
 
42
  demo.launch(
 
10
  extensions_dir = "./torch_extension/"
11
  os.environ["TORCH_EXTENSIONS_DIR"] = extensions_dir
12
 
 
 
13
 
14
+ @spaces.GPU
15
+ def update(name):
16
  from networks.generator import Generator
17
+ return f"Welcome to Gradio, {name}!"
 
 
 
 
 
 
 
 
18
 
 
 
19
 
20
+ with gr.Blocks() as demo:
21
+ gr.Markdown("Start typing below and then click **Run** to see the output.")
22
+ with gr.Row():
23
+ inp = gr.Textbox(placeholder="What is your name?")
24
+ out = gr.Textbox()
25
+ btn = gr.Button("Run")
26
+ btn.click(fn=update, inputs=inp, outputs=out)
 
 
 
27
 
28
 
29
  demo.launch(