Spaces:
Running
Running
Try loading moondream2
Browse files
app.py
CHANGED
@@ -1,15 +1,32 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
|
|
3 |
|
4 |
-
|
5 |
-
return f"Hello, {name}!"
|
6 |
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
if __name__ == "__main__":
|
15 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
# from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
|
6 |
+
# from PIL import Image
|
|
|
7 |
|
8 |
|
9 |
+
moondream_id = "vikhyatk/moondream2"
|
10 |
+
moondream_revision = "2024-04-02"
|
11 |
+
# moondream_model = AutoModelForCausalLM.from_pretrained(
|
12 |
+
# moondream_id, trust_remote_code=True, code_revision=moondream_revision
|
13 |
+
# )
|
14 |
+
# tokenizer = AutoTokenizer.from_pretrained(moondream_id, code_revision=moondream_revision)
|
15 |
+
pipe = pipeline(model=moondream_id, revision=moondream_revision, trust_remote_code=True)
|
16 |
+
|
17 |
+
with gr.Blocks() as app:
|
18 |
+
gr.Markdown(
|
19 |
+
"""
|
20 |
+
# Food Identifier
|
21 |
+
|
22 |
+
Final project for IAT 481 at Simon Fraser University, Spring 2024.
|
23 |
+
"""
|
24 |
+
)
|
25 |
+
with gr.Row():
|
26 |
+
prompt = gr.Textbox(label="Input", value="Describe this image.")
|
27 |
+
submit = gr.Button(label="Submit")
|
28 |
+
with gr.Row():
|
29 |
+
img = gr.Image(type="pil")
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
+
app.launch()
|