Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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,
|
142 |
|
143 |
-
ocr_result.change(openai_response, ocr_result, open_api_text, api_name="upload-
|
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)
|