vikhyatk commited on
Commit
1e62d51
1 Parent(s): 1a73d87

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -2
README.md CHANGED
@@ -9,8 +9,25 @@ language:
9
  The model is release for research purposes only, commercial use is not allowed.
10
 
11
  Try it out on [Huggingface Spaces](https://huggingface.co/spaces/vikhyatk/moondream1)!
12
- Or check out the [moondream repository on GitHub](https://github.com/vikhyat/moondream)
13
- for inference code and other details.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  ## Benchmarks
16
 
 
9
  The model is release for research purposes only, commercial use is not allowed.
10
 
11
  Try it out on [Huggingface Spaces](https://huggingface.co/spaces/vikhyatk/moondream1)!
12
+
13
+ **Usage**
14
+
15
+ ```
16
+ pip install transformers timm einops
17
+ ```
18
+
19
+ ```python
20
+ from transformers import AutoModelForCausalLM, CodeGenTokenizerFast as Tokenizer
21
+ from PIL import Image
22
+
23
+ model_id = "vikhyatk/moondream1"
24
+ model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
25
+ tokenizer = Tokenizer.from_pretrained(model_id)
26
+
27
+ image = Image.open('<IMAGE_PATH>')
28
+ enc_image = model.encode_image(image)
29
+ print(model.answer_question(enc_image, "<QUESTION>", tokenizer))
30
+ ```
31
 
32
  ## Benchmarks
33