Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -159,9 +159,6 @@ def extract_fields(image):
|
|
159 |
|
160 |
|
161 |
# -------------------- Gradio Interface --------------------
|
162 |
-
def extract_fields(image):
|
163 |
-
# Your full function definition goes here
|
164 |
-
return ["Name", "Email", "Phone", "DOB", "Postcode", "Prem", "Rate", "Functions"]
|
165 |
|
166 |
with gr.Blocks() as demo:
|
167 |
gr.Markdown("## π Image OCR Field Extractor")
|
@@ -170,13 +167,12 @@ with gr.Blocks() as demo:
|
|
170 |
with gr.Row():
|
171 |
with gr.Column():
|
172 |
image_input = gr.Image(type="pil", label="π€ Upload Your Document")
|
173 |
-
submit_btn = gr.Button("π Run
|
174 |
|
175 |
-
# β
One Example Image that auto-fills input when clicked
|
176 |
gr.Examples(
|
177 |
-
examples=["example_doc.jpeg"],
|
178 |
inputs=[image_input],
|
179 |
-
label="π Example Image (Click to load)"
|
180 |
)
|
181 |
|
182 |
with gr.Column():
|
@@ -189,11 +185,9 @@ with gr.Blocks() as demo:
|
|
189 |
rate = gr.Text(label="Temp (Hourly Rate)")
|
190 |
functions = gr.Textbox(label="Functions", lines=4)
|
191 |
|
192 |
-
# π Link button to function
|
193 |
submit_btn.click(fn=extract_fields, inputs=image_input,
|
194 |
outputs=[name, email, phone, dob, postcode, prem, rate, functions])
|
195 |
|
196 |
if __name__ == "__main__":
|
197 |
demo.launch()
|
198 |
|
199 |
-
|
|
|
159 |
|
160 |
|
161 |
# -------------------- Gradio Interface --------------------
|
|
|
|
|
|
|
162 |
|
163 |
with gr.Blocks() as demo:
|
164 |
gr.Markdown("## π Image OCR Field Extractor")
|
|
|
167 |
with gr.Row():
|
168 |
with gr.Column():
|
169 |
image_input = gr.Image(type="pil", label="π€ Upload Your Document")
|
170 |
+
submit_btn = gr.Button("π Run Extraction")
|
171 |
|
|
|
172 |
gr.Examples(
|
173 |
+
examples=["example_doc.jpeg"],
|
174 |
inputs=[image_input],
|
175 |
+
label="π Example Image (Click to load into uploader)"
|
176 |
)
|
177 |
|
178 |
with gr.Column():
|
|
|
185 |
rate = gr.Text(label="Temp (Hourly Rate)")
|
186 |
functions = gr.Textbox(label="Functions", lines=4)
|
187 |
|
|
|
188 |
submit_btn.click(fn=extract_fields, inputs=image_input,
|
189 |
outputs=[name, email, phone, dob, postcode, prem, rate, functions])
|
190 |
|
191 |
if __name__ == "__main__":
|
192 |
demo.launch()
|
193 |
|
|