HaanIlango commited on
Commit
cd8f6e4
·
verified ·
1 Parent(s): 0be29b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -813,21 +813,24 @@ with gr.Blocks(title="Design Analyzer") as demo:
813
  pdf_btn.click(fn=export_pdf, inputs=[image_output, chart_output, text_output], outputs=pdf_output)
814
  gr.Markdown("---\n© 2026 Haan Ilango. All rights reserved. This tool's methodology and design are original work.")
815
 
816
- demo.launch(prevent_thread_lock=True)
817
-
818
  from fastapi.middleware.cors import CORSMiddleware
 
 
 
819
 
820
- demo.app.add_middleware(
821
  CORSMiddleware,
822
  allow_origins=["*"],
823
  allow_methods=["GET"],
824
  allow_headers=["*"],
825
  )
826
 
827
- @demo.app.get("/count")
828
  def get_count():
829
  return {"count": read_counter()}
830
 
831
- import time
832
- while True:
833
- time.sleep(1)
 
 
813
  pdf_btn.click(fn=export_pdf, inputs=[image_output, chart_output, text_output], outputs=pdf_output)
814
  gr.Markdown("---\n© 2026 Haan Ilango. All rights reserved. This tool's methodology and design are original work.")
815
 
816
+ from fastapi import FastAPI
 
817
  from fastapi.middleware.cors import CORSMiddleware
818
+ import uvicorn
819
+
820
+ app = FastAPI()
821
 
822
+ app.add_middleware(
823
  CORSMiddleware,
824
  allow_origins=["*"],
825
  allow_methods=["GET"],
826
  allow_headers=["*"],
827
  )
828
 
829
+ @app.get("/count")
830
  def get_count():
831
  return {"count": read_counter()}
832
 
833
+ app = gr.mount_gradio_app(app, demo, path="/")
834
+
835
+ if __name__ == "__main__":
836
+ uvicorn.run(app, host="0.0.0.0", port=7860)