vithacocf commited on
Commit
03d0f19
·
verified ·
1 Parent(s): 627e875

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -219,3 +219,31 @@ def run_process(file, question, model_choice, temperature, top_p, external_api_u
219
 
220
  except Exception as e:
221
  return f"ERROR: {type(e).__name__}: {e}", None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
  except Exception as e:
221
  return f"ERROR: {type(e).__name__}: {e}", None
222
+
223
+ # ================== UI ==================
224
+ def main():
225
+ with gr.Blocks(title="OCR Multi-Agent System") as demo:
226
+ file = gr.File(label="Upload PDF/Image")
227
+ question = gr.Textbox(label="Prompt", lines=2)
228
+ model_choice = gr.Dropdown(choices=[*INTERNAL_MODEL_MAP.keys(), EXTERNAL_MODEL_NAME],
229
+ value="Gemini 2.5 Flash", label="Model")
230
+ temperature = gr.Slider(0.0, 2.0, value=0.2, step=0.05)
231
+ top_p = gr.Slider(0.0, 1.0, value=0.95, step=0.01)
232
+ external_api_url = gr.Textbox(label="External API URL", visible=False)
233
+ output_text = gr.Code(label="Output", language="json")
234
+ run_btn = gr.Button("🚀 Process")
235
+
236
+ run_btn.click(
237
+ run_process,
238
+ inputs=[file, question, model_choice, temperature, top_p, external_api_url],
239
+ outputs=[output_text, gr.State()]
240
+ )
241
+
242
+ return demo
243
+
244
+ demo = main()
245
+
246
+ if __name__ == "__main__":
247
+ import os
248
+ os.system("which gs || echo '⚠️ ghostscript (gs) not found in PATH'")
249
+ demo.launch()