Spaces:
Runtime error
Runtime error
| import os | |
| from pathlib import Path | |
| import streamlit as st | |
| from transformers import pipeline | |
| from dotenv import load_dotenv | |
| if Path(".env").is_file(): | |
| load_dotenv(".env") | |
| st.set_page_config(layout="wide") | |
| HF_TOKEN = os.getenv("HF_TOKEN") | |
| def img2Text(url) | |
| image_to_text = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large") | |
| text = image_to_text(url) | |
| print(text) | |
| return text | |
| img2Text(test-photo.png) |