Spaces:
Runtime error
Runtime error
nkasmanoff
commited on
Commit
•
b943b58
1
Parent(s):
452df71
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def predict(image,max_length=64,device='cpu'):
|
|
19 |
|
20 |
entity_pair = get_entities(generated_caption)
|
21 |
|
22 |
-
knowlege_triplet = f"{entity_pair[0]}
|
23 |
|
24 |
return knowlege_triplet
|
25 |
|
@@ -101,11 +101,12 @@ def get_relation(sent):
|
|
101 |
|
102 |
|
103 |
|
104 |
-
input = gr.inputs.Image(label="Please upload
|
105 |
output = gr.outputs.Textbox(type="text",label="Captions")
|
106 |
|
107 |
|
108 |
-
title = "Satellite Image
|
|
|
109 |
|
110 |
interface = gr.Interface(
|
111 |
fn=predict,
|
@@ -113,5 +114,6 @@ interface = gr.Interface(
|
|
113 |
theme="grass",
|
114 |
outputs=output,
|
115 |
title=title,
|
|
|
116 |
)
|
117 |
interface.launch(debug=True)
|
|
|
19 |
|
20 |
entity_pair = get_entities(generated_caption)
|
21 |
|
22 |
+
knowlege_triplet = f"'{entity_pair[0]}'---{relation}--->'{entity_pair[1]}'"
|
23 |
|
24 |
return knowlege_triplet
|
25 |
|
|
|
101 |
|
102 |
|
103 |
|
104 |
+
input = gr.inputs.Image(label="Please upload an image", type = 'pil', optional=True)
|
105 |
output = gr.outputs.Textbox(type="text",label="Captions")
|
106 |
|
107 |
|
108 |
+
title = "Satellite Image Knowledge Extraction"
|
109 |
+
description = "Provide an image taken from above, and receive back a corresponding head-relation-tail triplet that can be used to form a knowledge graph."
|
110 |
|
111 |
interface = gr.Interface(
|
112 |
fn=predict,
|
|
|
114 |
theme="grass",
|
115 |
outputs=output,
|
116 |
title=title,
|
117 |
+
|
118 |
)
|
119 |
interface.launch(debug=True)
|