Spaces:
Sleeping
Sleeping
Saurabh Kumar
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -20,8 +20,6 @@ st.title("OCR Image Text Extraction")
|
|
20 |
uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
21 |
|
22 |
if uploaded_file is not None:
|
23 |
-
# Open the uploaded image file
|
24 |
-
image = Image.open(uploaded_file)
|
25 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
26 |
|
27 |
# Add the spinner here while the model is processing
|
@@ -54,7 +52,7 @@ if uploaded_file is not None:
|
|
54 |
inputs = inputs.to("cpu")
|
55 |
|
56 |
# Inference: Generation of the output
|
57 |
-
generated_ids = MODEL.generate(**inputs, max_new_tokens=
|
58 |
generated_ids_trimmed = [
|
59 |
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
60 |
]
|
|
|
20 |
uploaded_file = st.file_uploader("Choose an image...", type=["png", "jpg", "jpeg"])
|
21 |
|
22 |
if uploaded_file is not None:
|
|
|
|
|
23 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
24 |
|
25 |
# Add the spinner here while the model is processing
|
|
|
52 |
inputs = inputs.to("cpu")
|
53 |
|
54 |
# Inference: Generation of the output
|
55 |
+
generated_ids = MODEL.generate(**inputs, max_new_tokens=512)
|
56 |
generated_ids_trimmed = [
|
57 |
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
58 |
]
|