merve HF staff commited on
Commit
f91e6ad
1 Parent(s): ef7f6f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -12,6 +12,11 @@ import os
12
  openai.api_key = os.getenv('API_KEY')
13
  reader = Reader(["tr"])
14
 
 
 
 
 
 
15
 
16
  def get_text(input_img):
17
  result = reader.readtext(input_img, detail=0)
@@ -138,9 +143,9 @@ with gr.Blocks() as demo:
138
  isim_soyisim = gr.Textbox(label="İsim Soyisim")
139
  adres = gr.Textbox(label="Adres")
140
 
141
- submit_button.click(get_text, img_area, ocr_result)
142
 
143
- ocr_result.change(openai_response, ocr_result, open_api_text, api_name="upload-file")
144
 
145
  open_api_text.change(text_dict_il, [open_api_text], il)
146
  open_api_text.change(text_dict_ilce, [open_api_text], ilce)
 
12
  openai.api_key = os.getenv('API_KEY')
13
  reader = Reader(["tr"])
14
 
15
+ def get_parsed_address(input_img):
16
+
17
+ address_full_text = get_text(input_img)
18
+ return openai_response(address_full_text)
19
+
20
 
21
  def get_text(input_img):
22
  result = reader.readtext(input_img, detail=0)
 
143
  isim_soyisim = gr.Textbox(label="İsim Soyisim")
144
  adres = gr.Textbox(label="Adres")
145
 
146
+ submit_button.click(get_text, inputs = img_area, outputs = open_api_text, api_name="upload_image")
147
 
148
+ ocr_result.change(openai_response, ocr_result, open_api_text, api_name="upload-text")
149
 
150
  open_api_text.change(text_dict_il, [open_api_text], il)
151
  open_api_text.change(text_dict_ilce, [open_api_text], ilce)