pragnakalp commited on
Commit
b9ebda9
1 Parent(s): 6a6acde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -33
app.py CHANGED
@@ -128,40 +128,40 @@ def generate_ocr(Method,img):
128
  """
129
  Save generated details
130
  """
131
- def save_details(Method,text_output,img):
132
- method = []
133
- img_path = []
134
- text = []
135
- input_img = ''
136
- hostname = ''
137
- picture_path = "image.jpg"
138
- curr_datetime = datetime.now().strftime('%Y-%m-%d %H-%M-%S')
139
- if text_output:
140
- splitted_path = os.path.splitext(picture_path)
141
- modified_picture_path = splitted_path[0] + curr_datetime + splitted_path[1]
142
- cv2.imwrite("myimage.jpg", img)
143
- with open('savedata.txt', 'w') as f:
144
- print("write test")
145
- f.write("testdata")
146
- print("write Successfully")
147
- # img = Image.open(r"/home/user/app/")
148
- # img.save(modified_picture_path)
149
- input_img = modified_picture_path
150
- try:
151
- df = pd.read_csv("AllDetails.csv")
152
- df2 = {'method': Method, 'input_img': input_img, 'generated_text': text_output}
153
- df = df.append(df2, ignore_index = True)
154
- df.to_csv("AllDetails.csv", index=False)
155
- except:
156
- method.append(Method)
157
- img_path.append(input_img)
158
- text.append(text_output)
159
- dict = {'method': method, 'input_img': img_path, 'generated_text': text}
160
- df = pd.DataFrame(dict,index=None)
161
- df.to_csv("AllDetails.csv")
162
 
163
- hostname = get_device_ip_address()
164
- return send_user_email(input_img,hostname,text_output,Method)
165
  # return hostname
166
 
167
  """
 
128
  """
129
  Save generated details
130
  """
131
+ # def save_details(Method,text_output,img):
132
+ # method = []
133
+ # img_path = []
134
+ # text = []
135
+ # input_img = ''
136
+ # hostname = ''
137
+ # picture_path = "image.jpg"
138
+ # curr_datetime = datetime.now().strftime('%Y-%m-%d %H-%M-%S')
139
+ # if text_output:
140
+ # splitted_path = os.path.splitext(picture_path)
141
+ # modified_picture_path = splitted_path[0] + curr_datetime + splitted_path[1]
142
+ # cv2.imwrite("myimage.jpg", img)
143
+ # with open('savedata.txt', 'w') as f:
144
+ # print("write test")
145
+ # f.write("testdata")
146
+ # print("write Successfully")
147
+ # # img = Image.open(r"/home/user/app/")
148
+ # # img.save(modified_picture_path)
149
+ # input_img = modified_picture_path
150
+ # try:
151
+ # df = pd.read_csv("AllDetails.csv")
152
+ # df2 = {'method': Method, 'input_img': input_img, 'generated_text': text_output}
153
+ # df = df.append(df2, ignore_index = True)
154
+ # df.to_csv("AllDetails.csv", index=False)
155
+ # except:
156
+ # method.append(Method)
157
+ # img_path.append(input_img)
158
+ # text.append(text_output)
159
+ # dict = {'method': method, 'input_img': img_path, 'generated_text': text}
160
+ # df = pd.DataFrame(dict,index=None)
161
+ # df.to_csv("AllDetails.csv")
162
 
163
+ # hostname = get_device_ip_address()
164
+ # return send_user_email(input_img,hostname,text_output,Method)
165
  # return hostname
166
 
167
  """