Spaces:
Sleeping
Sleeping
bachephysicdun
commited on
Commit
·
27306dd
1
Parent(s):
87ac28b
reverse to original file
Browse files- app/main.py +6 -17
app/main.py
CHANGED
@@ -17,16 +17,12 @@ models.Base.metadata.create_all(bind=engine)
|
|
17 |
|
18 |
app = FastAPI()
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
# @app.get("/")
|
28 |
-
# async def read_root():
|
29 |
-
# return {"message": "API is running!"}
|
30 |
|
31 |
|
32 |
async def generate_stream(input_data: schemas.BaseModel, runnable: Runnable, callbacks: List[BaseCallbackHandler]=[]):
|
@@ -49,13 +45,6 @@ async def simple_stream(request: Request):
|
|
49 |
# raise NotImplemented
|
50 |
|
51 |
|
52 |
-
# def get_db():
|
53 |
-
# db = SessionLocal()
|
54 |
-
# try:
|
55 |
-
# yield db
|
56 |
-
# finally:
|
57 |
-
# db.close()
|
58 |
-
|
59 |
# @app.post("/history/stream")
|
60 |
# async def history_stream(request: Request, db: Session = Depends(get_db)):
|
61 |
# # TODO: Let's implement the "/history/stream" endpoint. The endpoint should follow those steps:
|
|
|
17 |
|
18 |
app = FastAPI()
|
19 |
|
20 |
+
def get_db():
|
21 |
+
db = SessionLocal()
|
22 |
+
try:
|
23 |
+
yield db
|
24 |
+
finally:
|
25 |
+
db.close()
|
|
|
|
|
|
|
|
|
26 |
|
27 |
|
28 |
async def generate_stream(input_data: schemas.BaseModel, runnable: Runnable, callbacks: List[BaseCallbackHandler]=[]):
|
|
|
45 |
# raise NotImplemented
|
46 |
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
# @app.post("/history/stream")
|
49 |
# async def history_stream(request: Request, db: Session = Depends(get_db)):
|
50 |
# # TODO: Let's implement the "/history/stream" endpoint. The endpoint should follow those steps:
|