File size: 1,026 Bytes
582115f
c83f375
 
64fb58a
 
c83f375
64fb58a
 
 
 
 
 
 
582115f
 
 
 
 
64fb58a
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import gradio as gr

from gradio_caption import create_demo as create_caption
from gradio_vqa import create_demo as create_vqa


description = """
# Prismer 
The official demo for **Prismer: A Vision-Language Model with An Ensemble of Experts**.
Please refer to our [project page](https://shikun.io/projects/prismer) or [github](https://github.com/NVlabs/prismer) for more details.
"""

if (SPACE_ID := os.getenv('SPACE_ID')) is not None:
    description += f'<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>'


with gr.Blocks() as demo:
    gr.Markdown(description)
    with gr.Tab("Zero-shot Image Captioning"):
        create_caption()
    with gr.Tab("Visual Question Answering"):
        create_vqa()


if __name__ == '__main__':
    demo.queue().launch()