mlbench123 commited on
Commit
85c4555
·
verified ·
1 Parent(s): c055343

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -11
app.py CHANGED
@@ -14,6 +14,9 @@ import base64
14
  Real Estate Financial Model Pipeline
15
  Extracts data from PDFs, solves formulas with Gemini API, generates Excel
16
  """
 
 
 
17
 
18
  import re
19
  import json
@@ -1617,7 +1620,13 @@ class RealEstateModelPipeline:
1617
 
1618
  # ============= FastAPI Setup =============
1619
  app = FastAPI(title="Real Estate Financial Model API")
1620
-
 
 
 
 
 
 
1621
  # Hardcoded API Key
1622
  GEMINI_API_KEY = "AIzaSyCy6GoBR724Hj9VyuW3hKM4N0P6liBOlDo"
1623
 
@@ -2132,14 +2141,14 @@ with gr.Blocks(
2132
  """)
2133
 
2134
  # ============= Mount and Launch =============
2135
- if __name__ == "__main__":
2136
- # Mount Gradio to FastAPI
2137
- app = gr.mount_gradio_app(app, demo, path="/")
2138
 
2139
- # Launch with proper configuration
2140
- uvicorn.run(
2141
- app,
2142
- host="0.0.0.0",
2143
- port=7860,
2144
- log_level="info"
2145
- )
 
14
  Real Estate Financial Model Pipeline
15
  Extracts data from PDFs, solves formulas with Gemini API, generates Excel
16
  """
17
+ from fastapi.middleware.cors import CORSMiddleware
18
+
19
+
20
 
21
  import re
22
  import json
 
1620
 
1621
  # ============= FastAPI Setup =============
1622
  app = FastAPI(title="Real Estate Financial Model API")
1623
+ app.add_middleware(
1624
+ CORSMiddleware,
1625
+ allow_origins=["*"],
1626
+ allow_credentials=True,
1627
+ allow_methods=["*"],
1628
+ allow_headers=["*"],
1629
+ )
1630
  # Hardcoded API Key
1631
  GEMINI_API_KEY = "AIzaSyCy6GoBR724Hj9VyuW3hKM4N0P6liBOlDo"
1632
 
 
2141
  """)
2142
 
2143
  # ============= Mount and Launch =============
2144
+ # if __name__ == "__main__":
2145
+ # # Mount Gradio to FastAPI
2146
+ # app = gr.mount_gradio_app(app, demo, path="/")
2147
 
2148
+ # # Launch with proper configuration
2149
+ # uvicorn.run(
2150
+ # app,
2151
+ # host="0.0.0.0",
2152
+ # port=7860,
2153
+ # log_level="info"
2154
+ # )