sujataprakashdatycs commited on
Commit
a970e5d
ยท
verified ยท
1 Parent(s): 18b4c12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -15
app.py CHANGED
@@ -107,7 +107,6 @@ with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
107
  hcc_code = gr.Textbox(label="HCC Code (e.g., 12)", placeholder="Enter HCC code")
108
  model_version = gr.Dropdown(choices=["V24", "V28"], label="Model Version", value="V24")
109
  run_btn = gr.Button("๐Ÿš€ Run Validation", variant="primary")
110
- sample_btn = gr.Button("๐Ÿ“„ Use Sample PDF", variant="secondary")
111
 
112
  with gr.Column(scale=2):
113
  output_md = gr.Markdown(
@@ -115,32 +114,28 @@ with gr.Blocks(theme=simple_theme, title=APP_TITLE) as interface:
115
  value="<div style='border:2px solid #1e40af; border-radius:12px; padding:15px; background-color:#f0f9ff;'>๐Ÿ“„ Upload a PDF and click <b>Run Validation</b> to start.</div>",
116
  )
117
 
118
- # ---------- Button Events ----------
119
- # Corrected sample PDF loading
120
- def load_sample():
121
- if not os.path.exists(SAMPLE_PDF):
122
- raise FileNotFoundError(f"Sample PDF not found at {SAMPLE_PDF}")
123
- return (SAMPLE_PDF, os.path.basename(SAMPLE_PDF)) # (file_path, file_name)
124
-
125
- sample_btn.click(
126
- fn=load_sample,
127
- inputs=[],
128
- outputs=[pdf_upload],
129
- )
130
-
131
  run_btn.click(
132
  fn=process_pipeline,
133
  inputs=[pdf_upload, hcc_code, model_version],
134
  outputs=[output_md],
135
  )
136
 
 
 
 
 
 
 
 
 
 
137
 
138
  if __name__ == "__main__":
139
  interface.queue().launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
140
 
141
 
142
 
143
-
144
  # import os
145
  # import gradio as gr
146
  # import json
 
107
  hcc_code = gr.Textbox(label="HCC Code (e.g., 12)", placeholder="Enter HCC code")
108
  model_version = gr.Dropdown(choices=["V24", "V28"], label="Model Version", value="V24")
109
  run_btn = gr.Button("๐Ÿš€ Run Validation", variant="primary")
 
110
 
111
  with gr.Column(scale=2):
112
  output_md = gr.Markdown(
 
114
  value="<div style='border:2px solid #1e40af; border-radius:12px; padding:15px; background-color:#f0f9ff;'>๐Ÿ“„ Upload a PDF and click <b>Run Validation</b> to start.</div>",
115
  )
116
 
117
+ # ---------- Run validation ----------
 
 
 
 
 
 
 
 
 
 
 
 
118
  run_btn.click(
119
  fn=process_pipeline,
120
  inputs=[pdf_upload, hcc_code, model_version],
121
  outputs=[output_md],
122
  )
123
 
124
+ # ---------- Sample PDF using Gradio Examples ----------
125
+ gr.Examples(
126
+ examples=[[SAMPLE_PDF]],
127
+ inputs=[pdf_upload],
128
+ outputs=[output_md],
129
+ fn=process_pipeline,
130
+ cache_examples=True
131
+ )
132
+
133
 
134
  if __name__ == "__main__":
135
  interface.queue().launch(server_name="0.0.0.0", server_port=int(os.environ.get("PORT", 7860)))
136
 
137
 
138
 
 
139
  # import os
140
  # import gradio as gr
141
  # import json