Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
| 817 |
-
|
| 818 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
|
|
|
|
|
|
| 819 |
|
| 820 |
-
|
| 821 |
CORSMiddleware,
|
| 822 |
allow_origins=["*"],
|
| 823 |
allow_methods=["GET"],
|
| 824 |
allow_headers=["*"],
|
| 825 |
)
|
| 826 |
|
| 827 |
-
@
|
| 828 |
def get_count():
|
| 829 |
return {"count": read_counter()}
|
| 830 |
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
|
|
|
|
|
| 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)
|