Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1128,6 +1128,14 @@ app = FastAPI()
|
|
| 1128 |
# # Load function to initialize the state
|
| 1129 |
# # demo.load(load_fn, inputs=None, outputs=[state]) # Initialize the state when the page is loaded
|
| 1130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1131 |
|
| 1132 |
# In[21]:
|
| 1133 |
@app.get("/", response_class=JSONResponse)
|
|
|
|
| 1128 |
# # Load function to initialize the state
|
| 1129 |
# # demo.load(load_fn, inputs=None, outputs=[state]) # Initialize the state when the page is loaded
|
| 1130 |
|
| 1131 |
+
@app.on_event("startup")
|
| 1132 |
+
async def startup_event():
|
| 1133 |
+
logger.debug("Application startup initiated")
|
| 1134 |
+
# Simulate heavy operation
|
| 1135 |
+
# from transformers import pipeline
|
| 1136 |
+
# global model
|
| 1137 |
+
# model = pipeline("automatic-speech-recognition", model="openai/whisper-medium")
|
| 1138 |
+
logger.debug("Application startup complete")
|
| 1139 |
|
| 1140 |
# In[21]:
|
| 1141 |
@app.get("/", response_class=JSONResponse)
|