Spaces:
Runtime error
Runtime error
Commit
·
c7ec500
1
Parent(s):
d02d53b
test tti example
Browse files- .gitattributes +1 -0
- app.py +5 -4
- examples/root.jpg +3 -0
.gitattributes
CHANGED
|
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
examples/root.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -124,9 +124,10 @@ def single_inference_tti(head_txt, head_id, tail_txt, tail_id, question_img, que
|
|
| 124 |
inputs['attention_mask'][i, :idx[2], idx[2]:] = 0
|
| 125 |
|
| 126 |
# image
|
| 127 |
-
pixel_values = processor(images=
|
| 128 |
-
|
| 129 |
-
|
|
|
|
| 130 |
input_ids = inputs['input_ids']
|
| 131 |
|
| 132 |
model_output = mkgformer.model(**inputs, return_dict=True)
|
|
@@ -224,7 +225,7 @@ def single_tab_tti():
|
|
| 224 |
inputs=[head_text, head_ent, tail_text, tail_ent, question_image, question_ent],
|
| 225 |
outputs=[output_text])
|
| 226 |
|
| 227 |
-
examples=[['
|
| 228 |
ex = gr.Examples(
|
| 229 |
examples=examples,
|
| 230 |
fn=single_inference_iit,
|
|
|
|
| 124 |
inputs['attention_mask'][i, :idx[2], idx[2]:] = 0
|
| 125 |
|
| 126 |
# image
|
| 127 |
+
pixel_values = processor(images=question_img, return_tensors='pt')['pixel_values'].unsqueeze(1)
|
| 128 |
+
pixel_values = torch.cat((pixel_values, torch.zeros_like(pixel_values)), dim=1)
|
| 129 |
+
inputs['pixel_values'] = pixel_values
|
| 130 |
+
|
| 131 |
input_ids = inputs['input_ids']
|
| 132 |
|
| 133 |
model_output = mkgformer.model(**inputs, return_dict=True)
|
|
|
|
| 225 |
inputs=[head_text, head_ent, tail_text, tail_ent, question_image, question_ent],
|
| 226 |
outputs=[output_text])
|
| 227 |
|
| 228 |
+
examples=[['scrap', 'Q3217573', 'watch', 'Q178794', 'examples/root.jpg', 'Q111029']]
|
| 229 |
ex = gr.Examples(
|
| 230 |
examples=examples,
|
| 231 |
fn=single_inference_iit,
|
examples/root.jpg
ADDED
|
Git LFS Details
|