Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 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(
|