Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -74,13 +74,13 @@ def ocr_and_extract(image, text_query):
|
|
74 |
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
75 |
)
|
76 |
|
77 |
-
# Filter out
|
78 |
-
filtered_output = [line for line in output_text[0].split("\n") if not any(kw in line.lower() for kw in ["
|
79 |
|
80 |
# Clean up the temporary file
|
81 |
os.remove(temp_image_path)
|
82 |
|
83 |
-
return "\n".join(filtered_output)
|
84 |
|
85 |
except Exception as e:
|
86 |
error_message = str(e)
|
|
|
74 |
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
75 |
)
|
76 |
|
77 |
+
# Filter out "You are a helpful assistant" and "assistant" labels
|
78 |
+
filtered_output = [line for line in output_text[0].split("\n") if not any(kw in line.lower() for kw in ["you are a helpful assistant", "assistant", "user", "system"])]
|
79 |
|
80 |
# Clean up the temporary file
|
81 |
os.remove(temp_image_path)
|
82 |
|
83 |
+
return "\n".join(filtered_output).strip()
|
84 |
|
85 |
except Exception as e:
|
86 |
error_message = str(e)
|