Spaces:
Sleeping
Sleeping
Divyansh12
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -19,11 +19,11 @@ def load_model(model_name):
|
|
19 |
|
20 |
# Function to run the GOT model for multilingual OCR
|
21 |
@st.cache_data
|
22 |
-
def run_GOT(
|
23 |
unique_id = str(uuid.uuid4())
|
24 |
image_path = f"{unique_id}.png"
|
25 |
|
26 |
-
|
27 |
st.write(f"Saved image to {image_path}")
|
28 |
|
29 |
try:
|
@@ -72,7 +72,7 @@ if uploaded_image:
|
|
72 |
tokenizer, model = load_model(model_option)
|
73 |
|
74 |
# Run OCR and cache the result using @st.cache_data
|
75 |
-
result_text = run_GOT(image, tokenizer, model)
|
76 |
|
77 |
if "Error" not in result_text:
|
78 |
# Keyword input for search
|
|
|
19 |
|
20 |
# Function to run the GOT model for multilingual OCR
|
21 |
@st.cache_data
|
22 |
+
def run_GOT(_image, tokenizer, model):
|
23 |
unique_id = str(uuid.uuid4())
|
24 |
image_path = f"{unique_id}.png"
|
25 |
|
26 |
+
_image.save(image_path) # Save the image using the underscore variable
|
27 |
st.write(f"Saved image to {image_path}")
|
28 |
|
29 |
try:
|
|
|
72 |
tokenizer, model = load_model(model_option)
|
73 |
|
74 |
# Run OCR and cache the result using @st.cache_data
|
75 |
+
result_text = run_GOT(image, tokenizer, model) # Pass the original image here
|
76 |
|
77 |
if "Error" not in result_text:
|
78 |
# Keyword input for search
|