Spaces:
Running
on
Zero
Running
on
Zero
tomxxie
commited on
Commit
·
a5dad3b
1
Parent(s):
25ad8b4
增加图片展示
Browse files
app.py
CHANGED
@@ -29,8 +29,11 @@ def load_dict_from_yaml(file_path: str):
|
|
29 |
dict_1 = yaml.load(f, Loader=yaml.FullLoader)
|
30 |
return dict_1
|
31 |
|
|
|
|
|
|
|
32 |
# 将图片转换为 Base64
|
33 |
-
with open("lab.png", "rb") as image_file:
|
34 |
encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
|
35 |
|
36 |
# with open("./cat.jpg", "rb") as image_file:
|
|
|
29 |
dict_1 = yaml.load(f, Loader=yaml.FullLoader)
|
30 |
return dict_1
|
31 |
|
32 |
+
|
33 |
+
# 获取当前脚本文件的绝对路径
|
34 |
+
abs_path = os.path.abspath(__file__)
|
35 |
# 将图片转换为 Base64
|
36 |
+
with open(os.path.join(os.path.dirname(abs_path), "lab.png"), "rb") as image_file:
|
37 |
encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
|
38 |
|
39 |
# with open("./cat.jpg", "rb") as image_file:
|