limcheekin commited on
Commit
186f18b
1 Parent(s): ed04c7a

added code and updated for BAAI/bge-small-en-v1.5 model

Browse files
Files changed (5) hide show
  1. Dockerfile +1 -1
  2. LICENSE +21 -0
  3. README.md +5 -5
  4. main.py +21 -0
  5. start_server.sh +1 -1
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # Define global args
2
- ARG MODEL="BAAI/bge-large-en"
3
 
4
  FROM debian:bullseye-slim AS build-image
5
 
 
1
  # Define global args
2
+ ARG MODEL="BAAI/bge-small-en-v1.5"
3
 
4
  FROM debian:bullseye-slim AS build-image
5
 
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Lim Chee Kin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,19 +1,19 @@
1
  ---
2
- title: BAAI/bge-large-en OpenAI API-Compatible Endpoint
3
  emoji: 👁
4
  colorFrom: gray
5
  colorTo: pink
6
  sdk: docker
7
  models:
8
- - BAAI/bge-large-en
9
  tags:
10
  - inference api
11
  - openai-api compatible
12
  - open-text-embeddings
13
- - bge-large-en
14
  pinned: false
15
  ---
16
 
17
- # BAAI/bge-large-en OpenAI API-Compatible Endpoint
18
 
19
- Please refer to the [main screen](https://huggingface.co/spaces/limcheekin/bge-large-en) for more information.
 
1
  ---
2
+ title: BAAI/bge-small-en-v1.5 OpenAI API-Compatible Endpoint
3
  emoji: 👁
4
  colorFrom: gray
5
  colorTo: pink
6
  sdk: docker
7
  models:
8
+ - BAAI/bge-small-en-v1.5
9
  tags:
10
  - inference api
11
  - openai-api compatible
12
  - open-text-embeddings
13
+ - bge-small-en-v1.5
14
  pinned: false
15
  ---
16
 
17
+ # BAAI/bge-small-en-v1.5 OpenAI API-Compatible Endpoint
18
 
19
+ Please refer to the [main screen](https://huggingface.co/spaces/limcheekin/bge-small-en-v1.5) for more information.
main.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from open.text.embeddings.server.app import create_app
2
+ from fastapi.responses import HTMLResponse
3
+ import os
4
+
5
+ app = create_app()
6
+
7
+ # Read the content of index.html once and store it in memory
8
+ with open("index.html", "r") as f:
9
+ content = f.read()
10
+
11
+
12
+ @app.get("/", response_class=HTMLResponse)
13
+ async def read_items():
14
+ return content
15
+
16
+ if __name__ == "__main__":
17
+ import uvicorn
18
+ uvicorn.run(app,
19
+ host=os.environ["HOST"],
20
+ port=int(os.environ["PORT"])
21
+ )
start_server.sh CHANGED
@@ -1,3 +1,3 @@
1
  #!/bin/sh
2
 
3
- python -B -m open.text.embeddings.server
 
1
  #!/bin/sh
2
 
3
+ python -B main.py