Prashasst commited on
Commit
4c39be6
·
verified ·
1 Parent(s): e402274

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -321,13 +321,14 @@ Expected JSON format:
321
  # Gradio interface function
322
  def process_pdf(pdf):
323
  text = read_pdf(pdf) # Extract text from PDF
 
324
  output = generate(text) # Generate structured JSON
325
 
326
  return output
327
 
 
328
  def show_to_UI(pdf):
329
  output = process_pdf(pdf) # Call process_pdf to get JSON
330
- # output= {"metadata": {"name": "John Doe", "age": 30}, "lab_tests": [{"test": "Blood Sugar", "value": "120 mg/dL"}]}
331
 
332
  # Extract metadata
333
  metadata = output["metadata"]
@@ -341,6 +342,9 @@ def show_to_UI(pdf):
341
  f"**Report Date:** {metadata['report_date']}"
342
 
343
  return metadata_str, labtests, reds, output
 
 
 
344
 
345
  # Define Gradio interface
346
  with gr.Blocks() as demo:
@@ -356,5 +360,4 @@ with gr.Blocks() as demo:
356
  output_JSON = gr.JSON(label="Extracted Report") # Show JSON output
357
 
358
  submit_btn.click(show_to_UI, inputs=[pdf_input], outputs=[metadata_output, lab_test_output, reds_output,output_JSON])
359
-
360
- demo.launch()
 
321
  # Gradio interface function
322
  def process_pdf(pdf):
323
  text = read_pdf(pdf) # Extract text from PDF
324
+ # # print(text)
325
  output = generate(text) # Generate structured JSON
326
 
327
  return output
328
 
329
+
330
  def show_to_UI(pdf):
331
  output = process_pdf(pdf) # Call process_pdf to get JSON
 
332
 
333
  # Extract metadata
334
  metadata = output["metadata"]
 
342
  f"**Report Date:** {metadata['report_date']}"
343
 
344
  return metadata_str, labtests, reds, output
345
+
346
+
347
+
348
 
349
  # Define Gradio interface
350
  with gr.Blocks() as demo:
 
360
  output_JSON = gr.JSON(label="Extracted Report") # Show JSON output
361
 
362
  submit_btn.click(show_to_UI, inputs=[pdf_input], outputs=[metadata_output, lab_test_output, reds_output,output_JSON])
363
+ # demo.launch()