Shami96 commited on
Commit
938e469
·
verified ·
1 Parent(s): 290c46c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -529,15 +529,15 @@ with gr.Blocks(title="Professional Invoice Generator", css=custom_css) as demo:
529
  inputs=[uploaded_file, inv_date, inv_num, inv_type, modules, audit_type, s_audit_date, s_name, s_addr, s_email, s_phone, unit_override],
530
  outputs=[preview, dl_xlsx, dl_pdf]
531
  )
532
-
533
  if __name__ == "__main__":
534
  import os
535
- os.environ["GRADIO_SERVER_NAME"] = "0.0.0.0" # ensure correct bind in Spaces
536
  on_spaces = bool(os.getenv("SPACE_ID"))
 
 
537
  demo.launch(
538
- server_name="0.0.0.0",
539
- server_port=int(os.getenv("PORT", "7860")),
540
- share=on_spaces, # True on Spaces, False locally
541
- show_error=True
 
542
  )
543
-
 
529
  inputs=[uploaded_file, inv_date, inv_num, inv_type, modules, audit_type, s_audit_date, s_name, s_addr, s_email, s_phone, unit_override],
530
  outputs=[preview, dl_xlsx, dl_pdf]
531
  )
 
532
  if __name__ == "__main__":
533
  import os
 
534
  on_spaces = bool(os.getenv("SPACE_ID"))
535
+
536
+ # IMPORTANT: hide OpenAPI/schema (works around the json-schema bug)
537
  demo.launch(
538
+ server_name="0.0.0.0" if not on_spaces else None,
539
+ server_port=int(os.getenv("PORT", "7860")) if not on_spaces else None,
540
+ show_error=True,
541
+ show_api=False, # <—— prevents the schema from being built
542
+ share=False # <—— Spaces manages the URL; share=True not allowed
543
  )