Test / app.py
krypton's picture
Update app.py
48a6369 verified
raw
history blame
595 Bytes
import requests
from PIL import Image
import streamlit as st
from transformers import pipeline
pipe = pipeline("image-to-text", model="microsoft/trocr-large-printed")
st.title("Duh!")
# load image from the IAM dataset
url = "https://parivahan.gov.in/rcdlstatus/DispplayCaptcha?txtp_cd=1&bkgp_cd=2&noise_cd=2&gimp_cd=3&txtp_length=5&pfdrid_c=true?1429026471&pfdrid_c=true"
image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
col1, col2 = st.columns(2)
predictions = pipeline(image)
col1.image(image, use_column_width=True)
col2.subheader(f"Detected Text: {predictions}")