Download app.py from khamsam/sam: direct link, hf CLI and curl.
- Browser
- Download file 303 Bytes
-
https://huggingface.co/spaces/khamsam/sam/resolve/main/app.py
- Command line
-
hf download hf://spaces/khamsam/sam/app.py
-
curl -L -o app.py https://huggingface.co/spaces/khamsam/sam/resolve/main/app.py
303 Bytes
| from dotenv import find_dotenv,load_dotenv | |
| from transformers import pipeline | |
| load_dotenv(find_dotenv()) | |
| def img2txt(url): | |
| image_to_text= pipeline("image_to_text",model="salesforce/blip-image-captioning-base") | |
| text=image_to_text[url][0]["generated text"] | |
| print(text) | |
| return text | |