Ayesha-Majeed commited on
Commit
6b6b3f2
Β·
verified Β·
1 Parent(s): f4bdaf1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
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 Detection")
174
 
175
- # βœ… One Example Image that auto-fills input when clicked
176
  gr.Examples(
177
- examples=["example_doc.jpeg"], # Just one image
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