Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
-
|
|
|
|
| 4 |
|
| 5 |
# Load the image captioning model
|
| 6 |
model_name = "Salesforce/blip-image-captioning-large"
|
| 7 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 9 |
-
model =
|
| 10 |
|
| 11 |
# Streamlit app title and description
|
| 12 |
st.title("Image Information Extractor")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
+
import torch
|
| 4 |
+
from transformers import AutoFeatureExtractor, AutoModelForCausalLM, AutoTokenizer
|
| 5 |
|
| 6 |
# Load the image captioning model
|
| 7 |
model_name = "Salesforce/blip-image-captioning-large"
|
| 8 |
feature_extractor = AutoFeatureExtractor.from_pretrained(model_name)
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 10 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 11 |
|
| 12 |
# Streamlit app title and description
|
| 13 |
st.title("Image Information Extractor")
|