Skip to content

Commit

Permalink
添加下载测试用例的按钮
Browse files Browse the repository at this point in the history
  • Loading branch information
JieGenius committed Feb 4, 2024
1 parent 213231f commit 63d2185
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file added assets/test_case.zip
Binary file not shown.
8 changes: 7 additions & 1 deletion utils/actions/fundus_diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ def __call__(self, query: str) -> ActionReturn:
logger.info("query: " + query)
if query.startswith("{"):
query = query.replace("'", "\"") # 为了解决如下错误:{'image_path':'static/lwh017-20180821-OD-1.jpg'}
query = json.loads(query)
try:
query = json.loads(query)
except:
t = ActionReturn(url=None, args=None, type=self.name, )
t.result = "输入参数格式参数,输入需要为str:image_path"
t.state = ActionStatusCode.API_ERROR
return t
if not (isinstance(query, dict) and ("image_path" in query or "value" in query)):
response = "输入参数错误,请确定是否需要调用该工具"
tool_return = ActionReturn(url=None, args=None, type=self.name)
Expand Down
1 change: 1 addition & 0 deletions web_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def setup_sidebar(self):
st.session_state.file_upload_key = 0
uploaded_file = st.sidebar.file_uploader(
'眼底图文件', type=['png', 'jpg', 'jpeg'], key=st.session_state.file_upload_key)
st.sidebar.download_button(label="下载眼底图测试用例", data=open("assets/test_case.zip", "rb").read(), file_name="test_case.zip", mime="application/zip")
return model_name, model, plugin_action, uploaded_file

def init_model(self, option):
Expand Down

0 comments on commit 63d2185

Please sign in to comment.