Spaces:
Running
Running
ffreemt
commited on
Commit
•
7f5a78c
1
Parent(s):
2999f6e
Update landing in m3_server.py
Browse files- m3_server.py +10 -1
m3_server.py
CHANGED
@@ -124,7 +124,11 @@ class RequestProcessor:
|
|
124 |
except Exception as e:
|
125 |
raise HTTPException(status_code=500, detail=f"Internal Server Error {e}")
|
126 |
|
127 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
128 |
|
129 |
# Initialize the model and request processor
|
130 |
model = m3Wrapper('BAAI/bge-m3')
|
@@ -143,6 +147,11 @@ async def timeout_middleware(request: Request, call_next):
|
|
143 |
'processing_time': process_time},
|
144 |
status_code=HTTP_504_GATEWAY_TIMEOUT)
|
145 |
|
|
|
|
|
|
|
|
|
|
|
146 |
@app.post("/embeddings/", response_model=EmbedResponse)
|
147 |
async def get_embeddings(request: EmbedRequest):
|
148 |
embeddings = await processor.process_request(request, 'embed')
|
|
|
124 |
except Exception as e:
|
125 |
raise HTTPException(status_code=500, detail=f"Internal Server Error {e}")
|
126 |
|
127 |
+
app = FastAPI(
|
128 |
+
title="baai m3, serving embed and rerank",
|
129 |
+
description="Swagger UI at https://mikeee-baai-m3.hf.space/docs",
|
130 |
+
version="0.1.0a0",
|
131 |
+
)
|
132 |
|
133 |
# Initialize the model and request processor
|
134 |
model = m3Wrapper('BAAI/bge-m3')
|
|
|
147 |
'processing_time': process_time},
|
148 |
status_code=HTTP_504_GATEWAY_TIMEOUT)
|
149 |
|
150 |
+
@app.get("/")
|
151 |
+
async def landing():
|
152 |
+
"""Define landing page."""
|
153 |
+
return "Swagger UI at https://mikeee-baai-m3.hf.space/docs"
|
154 |
+
|
155 |
@app.post("/embeddings/", response_model=EmbedResponse)
|
156 |
async def get_embeddings(request: EmbedRequest):
|
157 |
embeddings = await processor.process_request(request, 'embed')
|