Spaces:
Runtime error
Runtime error
krypticmouse
commited on
Commit
•
7110ce4
1
Parent(s):
9c01716
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,10 @@ tokenizer = AutoTokenizer.from_pretrained(model_path)
|
|
25 |
print("Loaded tokenizer")
|
26 |
title = "Hindi Image Captioning"
|
27 |
description = ""
|
28 |
-
|
|
|
|
|
|
|
29 |
#example_images = sorted([f.as_posix() for f in Path("examples").glob("*.jpg")])
|
30 |
#print(f"Loaded {len(example_images)} example images")
|
31 |
article = "This huggingface presents a demo for Image captioning in Hindi built with VIT Encoder and GPT2 Decoder"
|
@@ -41,8 +44,20 @@ article = "This huggingface presents a demo for Image captioning in Hindi built
|
|
41 |
|
42 |
)'''
|
43 |
|
44 |
-
#inp=gr.inputs.Textbox(lines=1, placeholder=None, default="", label="search you query here")
|
45 |
output = gr.outputs.Textbox(type="auto",label="Captions")
|
46 |
|
47 |
interface = gr.Interface(fn=predict, inputs=input, outputs=output,article=article,title=title,theme="huggingface",layout='vertical')
|
48 |
-
interface.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
print("Loaded tokenizer")
|
26 |
title = "Hindi Image Captioning"
|
27 |
description = ""
|
28 |
+
|
29 |
+
input = gr.inputs.Image(label="Image to search", type = 'pil', optional=False)
|
30 |
+
output = gr.outputs.Textbox(type="auto",label="Captions")
|
31 |
+
|
32 |
#example_images = sorted([f.as_posix() for f in Path("examples").glob("*.jpg")])
|
33 |
#print(f"Loaded {len(example_images)} example images")
|
34 |
article = "This huggingface presents a demo for Image captioning in Hindi built with VIT Encoder and GPT2 Decoder"
|
|
|
44 |
|
45 |
)'''
|
46 |
|
47 |
+
'''#inp=gr.inputs.Textbox(lines=1, placeholder=None, default="", label="search you query here")
|
48 |
output = gr.outputs.Textbox(type="auto",label="Captions")
|
49 |
|
50 |
interface = gr.Interface(fn=predict, inputs=input, outputs=output,article=article,title=title,theme="huggingface",layout='vertical')
|
51 |
+
interface.launch(share=True)'''
|
52 |
+
|
53 |
+
cat_image = "./example_1.jpg"
|
54 |
+
dog_image = "./example_2.jpg"
|
55 |
+
iface = gr.Interface(
|
56 |
+
fn=predict,
|
57 |
+
inputs = input,
|
58 |
+
theme="grass",
|
59 |
+
outputs=output,
|
60 |
+
title=title,
|
61 |
+
description=article,
|
62 |
+
)
|
63 |
+
iface.launch()
|