merve HF Staff commited on
Commit
96fb496
·
1 Parent(s): 7f4f78a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -38,6 +38,15 @@ def get_text(input_img):
38
  result = reader.readtext(input_img, detail=0)
39
  return " ".join(result)
40
 
 
 
 
 
 
 
 
 
 
41
 
42
  def save_csv(mahalle, il, sokak, apartman):
43
  adres_full = [mahalle, il, sokak, apartman]
@@ -65,7 +74,7 @@ def write_db(data_dict):
65
 
66
  def text_dict(input):
67
  print(input)
68
- eval_result = eval(input)
69
  #eval_result = ast.literal_eval(input)
70
  write_db(eval_result)
71
 
 
38
  result = reader.readtext(input_img, detail=0)
39
  return " ".join(result)
40
 
41
+ def get_address(resp):
42
+ entity_dict = {"il":"", "ilce":"", "Apartman/Site":"","mahalle":"",
43
+ "ad-soyad":"", "ic kapi no":"", "kat":"", "sokak":""}
44
+ for item in resp:
45
+ for group in entity_dict:
46
+ if item["entity_group"] == group:
47
+ entity_dict[group] += item["word"]
48
+ return entity_dict
49
+
50
 
51
  def save_csv(mahalle, il, sokak, apartman):
52
  adres_full = [mahalle, il, sokak, apartman]
 
74
 
75
  def text_dict(input):
76
  print(input)
77
+ eval_result = get_address(input)
78
  #eval_result = ast.literal_eval(input)
79
  write_db(eval_result)
80