Commit
·
3124969
1
Parent(s):
8fa6796
update
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ with gr.Blocks() as demo:
|
|
| 15 |
with gr.TabItem("E-FB15k237"):
|
| 16 |
with gr.Row():
|
| 17 |
with gr.Column():
|
| 18 |
-
|
| 19 |
|
| 20 |
alter_label = gr.Textbox(label="Alter Entity", lines=1, placeholder="Entity Name")
|
| 21 |
edit_button = gr.Button("Edit")
|
|
@@ -26,7 +26,7 @@ with gr.Blocks() as demo:
|
|
| 26 |
|
| 27 |
gr.Examples(
|
| 28 |
examples=[["[MASK] r1 t1", "h1"], ["[MASK] r2 t2", "h2"]],
|
| 29 |
-
inputs=[
|
| 30 |
outputs=[origin_output, edit_output],
|
| 31 |
fn=edit_process,
|
| 32 |
cache_examples=True,
|
|
@@ -35,9 +35,9 @@ with gr.Blocks() as demo:
|
|
| 35 |
with gr.TabItem("A-FB15k237"):
|
| 36 |
with gr.Row():
|
| 37 |
with gr.Column():
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
add_button = gr.Button("Add")
|
| 42 |
|
| 43 |
with gr.Column():
|
|
@@ -46,14 +46,14 @@ with gr.Blocks() as demo:
|
|
| 46 |
|
| 47 |
gr.Examples(
|
| 48 |
examples=[["h1 r1 t1", "1"], ["h2 r2 t2", "1"]],
|
| 49 |
-
inputs=[
|
| 50 |
outputs=[add_origin_output, add_output],
|
| 51 |
fn=add_process,
|
| 52 |
cache_examples=True,
|
| 53 |
)
|
| 54 |
|
| 55 |
# origin_button.click(fn=origin_preditcion, inputs=[input, alter_label], outputs=origin_output)
|
| 56 |
-
edit_button.click(fn=edit_process, inputs=[
|
| 57 |
-
add_button.click(fn=add_process, inputs=[
|
| 58 |
|
| 59 |
demo.launch()
|
|
|
|
| 15 |
with gr.TabItem("E-FB15k237"):
|
| 16 |
with gr.Row():
|
| 17 |
with gr.Column():
|
| 18 |
+
edit_input = gr.Textbox(label="Input", lines=1, placeholder="Mask triple input")
|
| 19 |
|
| 20 |
alter_label = gr.Textbox(label="Alter Entity", lines=1, placeholder="Entity Name")
|
| 21 |
edit_button = gr.Button("Edit")
|
|
|
|
| 26 |
|
| 27 |
gr.Examples(
|
| 28 |
examples=[["[MASK] r1 t1", "h1"], ["[MASK] r2 t2", "h2"]],
|
| 29 |
+
inputs=[edit_input, alter_label],
|
| 30 |
outputs=[origin_output, edit_output],
|
| 31 |
fn=edit_process,
|
| 32 |
cache_examples=True,
|
|
|
|
| 35 |
with gr.TabItem("A-FB15k237"):
|
| 36 |
with gr.Row():
|
| 37 |
with gr.Column():
|
| 38 |
+
add_input = gr.Textbox(label="Input", lines=1, placeholder="New triple input")
|
| 39 |
|
| 40 |
+
mask_head = gr.Textbox(label="Head/Tail", lines=1, placeholder="1:head / 0:tail")
|
| 41 |
add_button = gr.Button("Add")
|
| 42 |
|
| 43 |
with gr.Column():
|
|
|
|
| 46 |
|
| 47 |
gr.Examples(
|
| 48 |
examples=[["h1 r1 t1", "1"], ["h2 r2 t2", "1"]],
|
| 49 |
+
inputs=[add_input, mask_head],
|
| 50 |
outputs=[add_origin_output, add_output],
|
| 51 |
fn=add_process,
|
| 52 |
cache_examples=True,
|
| 53 |
)
|
| 54 |
|
| 55 |
# origin_button.click(fn=origin_preditcion, inputs=[input, alter_label], outputs=origin_output)
|
| 56 |
+
edit_button.click(fn=edit_process, inputs=[edit_input, alter_label], outputs=[origin_output, edit_output])
|
| 57 |
+
add_button.click(fn=add_process, inputs=[add_input, mask_head], outputs=[add_origin_output, add_output])
|
| 58 |
|
| 59 |
demo.launch()
|