Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,18 +53,19 @@ if img_file_buffer is not None:
|
|
53 |
|
54 |
# Run tesseract OCR on the cropped image
|
55 |
text = pytesseract.image_to_string(new_img, lang="eng")
|
56 |
-
print("Recognized Text:", text)
|
57 |
|
58 |
# Data is stored in CSV file
|
59 |
raw_data = {'date': [time.asctime(time.localtime(time.time()))], 'v_number': [text]}
|
60 |
df = pd.DataFrame(raw_data, columns=['date', 'v_number'])
|
|
|
|
|
61 |
file_path = 'data.csv'
|
62 |
header = not os.path.exists(file_path)
|
63 |
|
64 |
df.to_csv('data.csv', mode='a', header=header, index=False)
|
65 |
|
66 |
# Print recognized text
|
67 |
-
st.write(text)
|
68 |
|
69 |
if bytes_data is None:
|
70 |
st.stop()
|
|
|
53 |
|
54 |
# Run tesseract OCR on the cropped image
|
55 |
text = pytesseract.image_to_string(new_img, lang="eng")
|
|
|
56 |
|
57 |
# Data is stored in CSV file
|
58 |
raw_data = {'date': [time.asctime(time.localtime(time.time()))], 'v_number': [text]}
|
59 |
df = pd.DataFrame(raw_data, columns=['date', 'v_number'])
|
60 |
+
|
61 |
+
# check if the csv file exists
|
62 |
file_path = 'data.csv'
|
63 |
header = not os.path.exists(file_path)
|
64 |
|
65 |
df.to_csv('data.csv', mode='a', header=header, index=False)
|
66 |
|
67 |
# Print recognized text
|
68 |
+
st.write("Recognized Text:",text)
|
69 |
|
70 |
if bytes_data is None:
|
71 |
st.stop()
|