Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -12,7 +12,7 @@ import os
|
|
12 |
app = Flask(__name__)
|
13 |
app.json.sort_keys = False
|
14 |
|
15 |
-
parser = argparse.ArgumentParser(description="An example of
|
16 |
parser.add_argument("--host", type=str, help="Set the ip address.(default: 0.0.0.0)", default='0.0.0.0')
|
17 |
parser.add_argument("--port", type=int, help="Set the port.(default: 7860)", default=7860)
|
18 |
args = parser.parse_args()
|
@@ -27,7 +27,7 @@ def model_list():
|
|
27 |
"object": "list",
|
28 |
"data": [
|
29 |
{
|
30 |
-
"id": "
|
31 |
"object": "model",
|
32 |
"created": time_now,
|
33 |
"owned_by": "tastypear"
|
@@ -44,7 +44,7 @@ def model_list():
|
|
44 |
|
45 |
@app.route("/", methods=["GET"])
|
46 |
def index():
|
47 |
-
return Response(f'
|
48 |
f'Set "{os.getenv("SPACE_URL")}/api" as proxy (or API Domain) in your Chatbot.<br><br>'+
|
49 |
f'The complete API is: {os.getenv("SPACE_URL")}/api/v1/chat/completions')
|
50 |
|
@@ -136,7 +136,7 @@ def gen_res_data(data, time_now=0, start=False):
|
|
136 |
"id": "chatcmpl",
|
137 |
"object": "chat.completion.chunk",
|
138 |
"created": time_now,
|
139 |
-
"model": "
|
140 |
"choices": [{"index": 0, "finish_reason": None}],
|
141 |
}
|
142 |
|
|
|
12 |
app = Flask(__name__)
|
13 |
app.json.sort_keys = False
|
14 |
|
15 |
+
parser = argparse.ArgumentParser(description="An example of Zhipu GLM-4 with a similar API to OAI.")
|
16 |
parser.add_argument("--host", type=str, help="Set the ip address.(default: 0.0.0.0)", default='0.0.0.0')
|
17 |
parser.add_argument("--port", type=int, help="Set the port.(default: 7860)", default=7860)
|
18 |
args = parser.parse_args()
|
|
|
27 |
"object": "list",
|
28 |
"data": [
|
29 |
{
|
30 |
+
"id": "chatglm4",
|
31 |
"object": "model",
|
32 |
"created": time_now,
|
33 |
"owned_by": "tastypear"
|
|
|
44 |
|
45 |
@app.route("/", methods=["GET"])
|
46 |
def index():
|
47 |
+
return Response(f'GLM4 OpenAI Compatible API<br><br>'+
|
48 |
f'Set "{os.getenv("SPACE_URL")}/api" as proxy (or API Domain) in your Chatbot.<br><br>'+
|
49 |
f'The complete API is: {os.getenv("SPACE_URL")}/api/v1/chat/completions')
|
50 |
|
|
|
136 |
"id": "chatcmpl",
|
137 |
"object": "chat.completion.chunk",
|
138 |
"created": time_now,
|
139 |
+
"model": "chatglm4",
|
140 |
"choices": [{"index": 0, "finish_reason": None}],
|
141 |
}
|
142 |
|