Spaces:
Sleeping
Sleeping
import streamlit as st | |
from groq import Groq | |
def extract_id_details(image_url): | |
client = Groq() | |
completion = client.chat.completions.create( | |
model="llama-3.2-90b-vision-preview", | |
messages=[ | |
{ | |
"role": "user", | |
"content": [ | |
{"type": "text", "text": "List all the details from the provided image of an ID card."}, | |
{"type": "image_url", "image_url": {"url": image_url}} | |
] | |
} | |
], | |
temperature=0.2, | |
max_completion_tokens=200, | |
top_p=1, | |
stream=False, | |
stop=None, | |
) | |
return completion.choices[0].message.content | |
st.title("ID Card OCR Extractor") | |
image_url = st.text_input("Enter the image URL:") | |
if st.button("Extract Details"): | |
if image_url: | |
with st.spinner("Extracting details..."): | |
details = extract_id_details(image_url) | |
st.subheader("Extracted Details:") | |
st.write(details) | |
else: | |
st.warning("Please enter a valid image URL.") | |