Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,10 +58,15 @@ if img_file_buffer is not None:
|
|
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 |
-
#
|
62 |
file_path = os.path.join("data", "data.csv")
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
# Print recognized text
|
67 |
st.write("Recognized Text:",text)
|
|
|
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 = os.path.join("data", "data.csv")
|
63 |
+
if os.path.exists(file_path):
|
64 |
+
# Append the data to the existing CSV file
|
65 |
+
df.to_csv(file_path, mode='a', header=False, index=False)
|
66 |
+
else:
|
67 |
+
# Create a new CSV file and write the data
|
68 |
+
df.to_csv(file_path, mode='w', index=False)
|
69 |
+
|
70 |
|
71 |
# Print recognized text
|
72 |
st.write("Recognized Text:",text)
|