File size: 953 Bytes
5756dad
77b3326
5756dad
77b3326
5756dad
77b3326
5756dad
 
77b3326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5756dad
 
77b3326
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
29
30
31
32
33
import gradio as gr
from transformers import pipeline

# from transformers import AutoModelForCausalLM, AutoTokenizer

# from PIL import Image


moondream_id = "vikhyatk/moondream2"
moondream_revision = "2024-04-02"
# moondream_model = AutoModelForCausalLM.from_pretrained(
#     moondream_id, trust_remote_code=True, code_revision=moondream_revision
# )
# tokenizer = AutoTokenizer.from_pretrained(moondream_id, code_revision=moondream_revision)
pipe = pipeline(model=moondream_id, revision=moondream_revision, trust_remote_code=True)

with gr.Blocks() as app:
    gr.Markdown(
        """
        # Food Identifier
        
        Final project for IAT 481 at Simon Fraser University, Spring 2024.
        """
    )
    with gr.Row():
        prompt = gr.Textbox(label="Input", value="Describe this image.")
        submit = gr.Button(label="Submit")
    with gr.Row():
        img = gr.Image(type="pil")

if __name__ == "__main__":
    app.launch()