moamen270 commited on
Commit
28ff6a7
·
1 Parent(s): bc6051b

Update endpoints.py

Browse files
Files changed (1) hide show
  1. endpoints.py +19 -7
endpoints.py CHANGED
@@ -1,8 +1,6 @@
1
  from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
- from routers import dataset
4
- from routers import ocr
5
- from routers import chatgpt_plugin
6
 
7
  app = FastAPI(openapi_url="/api/v1/sparrow-data/openapi.json", docs_url="/api/v1/sparrow-data/docs")
8
 
@@ -14,11 +12,25 @@ app.add_middleware(
14
  allow_credentials=True,
15
  )
16
 
17
- app.include_router(dataset.router, prefix="/api-dataset/v1/sparrow-data", tags=["Dataset"])
18
- app.include_router(ocr.router, prefix="/api-ocr/v1/sparrow-data", tags=["OCR"])
19
- app.include_router(chatgpt_plugin.router, prefix="/api-chatgpt-plugin/v1/sparrow-data", tags=["ChatGPT Plugin"])
20
 
21
 
22
  @app.get("/")
23
  async def root():
24
- return {"message": "R&D LLM API"}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
+
 
 
4
 
5
  app = FastAPI(openapi_url="/api/v1/sparrow-data/openapi.json", docs_url="/api/v1/sparrow-data/docs")
6
 
 
12
  allow_credentials=True,
13
  )
14
 
15
+
 
 
16
 
17
 
18
  @app.get("/")
19
  async def root():
20
+ return {"message": "R&D LLM API"}
21
+ @app.get("/get")
22
+ async def get():
23
+
24
+ return {"message": "try"}
25
+
26
+
27
+ def askLLM(prompt):
28
+ output = query({
29
+ "inputs": prompt
30
+ })
31
+ return output
32
+
33
+ @app.post("/ask_llm")
34
+ async def ask_llm_endpoint(prompt: str):
35
+ result = askLLM(prompt)
36
+ return {"result": result}