Spaces:
Runtime error
Runtime error
File size: 465 Bytes
4b2a398 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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)
st.subheader(text)
print(text)
return text
img2Text(test-photo.png) |