braintacles
commited on
Commit
•
ecae096
1
Parent(s):
d4a872e
Update README.md
Browse files
README.md
CHANGED
@@ -31,7 +31,7 @@ processor = AutoProcessor.from_pretrained("Salesforce/blip-image-captioning-base
|
|
31 |
model = BlipForConditionalGeneration.from_pretrained("braintacles/brainblip").to("cuda")
|
32 |
|
33 |
image_path_or_url = r"https://imagePath_or_url.jpg"
|
34 |
-
raw_image = Image.open(requests.get(
|
35 |
|
36 |
inputs = processor(raw_image, return_tensors="pt").to("cuda")
|
37 |
out = model.generate(**inputs, min_length=40, max_new_tokens=75, num_beams=5, repetition_penalty=1.40)
|
|
|
31 |
model = BlipForConditionalGeneration.from_pretrained("braintacles/brainblip").to("cuda")
|
32 |
|
33 |
image_path_or_url = r"https://imagePath_or_url.jpg"
|
34 |
+
raw_image = Image.open(requests.get(image_path_or_url, stream=True).raw) if image_path_or_url.startswith("http") else Image.open(image_path_or_url)
|
35 |
|
36 |
inputs = processor(raw_image, return_tensors="pt").to("cuda")
|
37 |
out = model.generate(**inputs, min_length=40, max_new_tokens=75, num_beams=5, repetition_penalty=1.40)
|