Spaces:
Sleeping
Sleeping
朱东升
commited on
Commit
·
33da27c
1
Parent(s):
edf1ecb
update10
Browse files
app.py
CHANGED
@@ -827,6 +827,15 @@ if __name__ == "__main__":
|
|
827 |
except Exception as e:
|
828 |
return {"status": "error", "message": str(e)}
|
829 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
830 |
# 启动应用到FastAPI
|
831 |
demo.launch(
|
832 |
**launch_kwargs,
|
@@ -838,6 +847,8 @@ if __name__ == "__main__":
|
|
838 |
# 设置队列,并添加API支持
|
839 |
try:
|
840 |
demo.queue(api_open=True, max_size=30)
|
|
|
|
|
841 |
except Exception as e:
|
842 |
logger.warning(f"配置队列时出错: {e}")
|
843 |
|
|
|
827 |
except Exception as e:
|
828 |
return {"status": "error", "message": str(e)}
|
829 |
|
830 |
+
# 添加/evaluate API端点
|
831 |
+
@app.post("/evaluate")
|
832 |
+
async def evaluate_api(data: list):
|
833 |
+
try:
|
834 |
+
result = evaluate(data)
|
835 |
+
return result
|
836 |
+
except Exception as e:
|
837 |
+
return {"status": "error", "message": str(e)}
|
838 |
+
|
839 |
# 启动应用到FastAPI
|
840 |
demo.launch(
|
841 |
**launch_kwargs,
|
|
|
847 |
# 设置队列,并添加API支持
|
848 |
try:
|
849 |
demo.queue(api_open=True, max_size=30)
|
850 |
+
# 添加/evaluate API端点
|
851 |
+
demo.add_api_route("/evaluate", evaluate, methods=["POST"])
|
852 |
except Exception as e:
|
853 |
logger.warning(f"配置队列时出错: {e}")
|
854 |
|