Spaces:
Runtime error
Runtime error
Commit
·
a6e53ee
1
Parent(s):
7c79031
init
Browse files
app.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def single_inference():
|
| 4 |
+
pass
|
| 5 |
+
|
| 6 |
+
def blended_inference():
|
| 7 |
+
pass
|
| 8 |
+
|
| 9 |
+
TITLE = """MKG Analogy"""
|
| 10 |
+
|
| 11 |
+
with gr.Blocks() as block:
|
| 12 |
+
with gr.Column(elem_id="col-container"):
|
| 13 |
+
gr.HTML(TITLE)
|
| 14 |
+
|
| 15 |
+
with gr.Tab("Single Analogical Reasoning"):
|
| 16 |
+
with gr.Row():
|
| 17 |
+
head_image = gr.Image(type='pil', label="Head Image")
|
| 18 |
+
head_ent = gr.Textbox(lines=1, label="Head Entity")
|
| 19 |
+
with gr.Column():
|
| 20 |
+
tail_image = gr.Image(type='pil', label="Tail Image")
|
| 21 |
+
tail_ent = gr.Textbox(lines=1, label="Tail Entity")
|
| 22 |
+
with gr.Column():
|
| 23 |
+
question_text = gr.Textbox(lines=1, label="Question Entity")
|
| 24 |
+
question_ent = gr.Textbox(lines=1, label="Question Entity")
|
| 25 |
+
submit_btn = gr.Button("Submit")
|
| 26 |
+
output_text = gr.Textbox(label="Answer Name")
|
| 27 |
+
|
| 28 |
+
# examples=[['example01.jpg', MODELS[0], 'best'], ['example02.jpg', MODELS[0], 'best']]
|
| 29 |
+
# ex = gr.Examples(
|
| 30 |
+
# examples=examples,
|
| 31 |
+
# fn=image_to_prompt,
|
| 32 |
+
# inputs=[input_image, input_model, input_mode],
|
| 33 |
+
# outputs=[output_text, share_button, community_icon, loading_icon],
|
| 34 |
+
# cache_examples=True,
|
| 35 |
+
# run_on_click=True
|
| 36 |
+
# )
|
| 37 |
+
# ex.dataset.headers = [""]
|
| 38 |
+
|
| 39 |
+
with gr.Tab("Blended Analogical Reasoning"):
|
| 40 |
+
pass
|
| 41 |
+
|
| 42 |
+
# gr.HTML(ARTICLE)
|
| 43 |
+
|
| 44 |
+
# submit_btn.click(
|
| 45 |
+
# fn=image_to_prompt,
|
| 46 |
+
# inputs=[input_image, input_model, input_mode],
|
| 47 |
+
# outputs=[output_text, share_button, community_icon, loading_icon]
|
| 48 |
+
# )
|
| 49 |
+
# share_button.click(None, [], [], _js=None)
|
| 50 |
+
|
| 51 |
+
block.queue(max_size=64).launch(enable_queue=True)
|