소스 검색

add `GET /models` endpoint

Jeffrey Morgan 1 년 전
부모
커밋
51164f57a2
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      proto.py

+ 6 - 0
proto.py

@@ -74,6 +74,12 @@ def generate():
         stream_with_context(stream_response()), mimetype="text/event-stream"
     )
 
+@app.route("/models", methods=["GET"])
+def models():
+    all_files = os.listdir("./models")
+    bin_files = [file.replace(".bin", "") for file in all_files if file.endswith(".bin")]
+    return Response(json.dumps(bin_files), mimetype="application/json")
+
 if __name__ == "__main__":
     app.run(debug=True, threaded=True, port=5001)
     app.run()