ChancesYuan commited on
Commit
6fc1c67
·
1 Parent(s): f58c303
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -1,13 +1,10 @@
1
  import gradio as gr
2
 
3
- def origin_preditcion(title, context):
4
- return f"Title:{title}\nContext:{context}\n..."
5
-
6
  def edit_process(title, context):
7
  return f"Title:{title}\nContext:{context}\n...", f"Title:{title}\nContext:{context}\n..."
8
 
9
  def add_process(title, context, img):
10
- return f"Title:{title}\nContext:{context}\n...{img}"
11
 
12
  with gr.Blocks() as demo:
13
  gr.Markdown("# KGE Editing")
@@ -19,7 +16,7 @@ with gr.Blocks() as demo:
19
  with gr.Row():
20
  with gr.Column():
21
  input = gr.Textbox(label="Input", lines=1, placeholder="Mask triple input")
22
- origin_button = gr.Button("Origin")
23
 
24
  with gr.Column():
25
  origin_output = gr.Textbox(label="Before Edit", lines=3, placeholder="")
@@ -48,18 +45,19 @@ with gr.Blocks() as demo:
48
  add_button = gr.Button("Add")
49
 
50
  with gr.Column():
51
- add_output = gr.Textbox(label="Add Results", lines=5, placeholder="")
 
52
 
53
  gr.Examples(
54
  examples=[["h1 r1 t1", "1"], ["h2 r2 t2", "1"]],
55
  inputs=[input, alter_label],
56
- outputs=add_output,
57
  fn=add_process,
58
  cache_examples=True,
59
  )
60
 
61
- origin_button.click(fn=origin_preditcion, inputs=[input, alter_label], outputs=origin_output)
62
  edit_button.click(fn=edit_process, inputs=[input, alter_label], outputs=[origin_output, edit_output])
63
- add_button.click(fn=add_process, inputs=[input, alter_label], outputs=add_output)
64
 
65
  demo.launch()
 
1
  import gradio as gr
2
 
 
 
 
3
  def edit_process(title, context):
4
  return f"Title:{title}\nContext:{context}\n...", f"Title:{title}\nContext:{context}\n..."
5
 
6
  def add_process(title, context, img):
7
+ return f"Title:{title}\nContext:{context}\n...{img}", f"Title:{title}\nContext:{context}\n...{img}"
8
 
9
  with gr.Blocks() as demo:
10
  gr.Markdown("# KGE Editing")
 
16
  with gr.Row():
17
  with gr.Column():
18
  input = gr.Textbox(label="Input", lines=1, placeholder="Mask triple input")
19
+ # origin_button = gr.Button("Origin")
20
 
21
  with gr.Column():
22
  origin_output = gr.Textbox(label="Before Edit", lines=3, placeholder="")
 
45
  add_button = gr.Button("Add")
46
 
47
  with gr.Column():
48
+ add_origin_output = gr.Textbox(label="Origin Results", lines=3, placeholder="")
49
+ add_output = gr.Textbox(label="Add Results", lines=3, placeholder="")
50
 
51
  gr.Examples(
52
  examples=[["h1 r1 t1", "1"], ["h2 r2 t2", "1"]],
53
  inputs=[input, alter_label],
54
+ outputs=[add_origin_output, add_output],
55
  fn=add_process,
56
  cache_examples=True,
57
  )
58
 
59
+ # origin_button.click(fn=origin_preditcion, inputs=[input, alter_label], outputs=origin_output)
60
  edit_button.click(fn=edit_process, inputs=[input, alter_label], outputs=[origin_output, edit_output])
61
+ add_button.click(fn=add_process, inputs=[input, alter_label], outputs=[add_origin_output, add_output])
62
 
63
  demo.launch()