Spaces:
Runtime error
Runtime error
hcs
commited on
Commit
·
8d3b05d
1
Parent(s):
67dc00b
Add application file
Browse files
app.py
CHANGED
@@ -1,4 +1,27 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
|
4 |
+
|
5 |
+
# 加载模型和其他必要的库
|
6 |
+
|
7 |
+
# Streamlit 应用程序
|
8 |
+
def main():
|
9 |
+
st.title("颜值打分应用")
|
10 |
+
uploaded_image = st.file_uploader("上传一张图片", type=["png", "jpg", "jpeg"])
|
11 |
+
|
12 |
+
if uploaded_image is not None:
|
13 |
+
# 读取上传的图片
|
14 |
+
image = Image.open(uploaded_image)
|
15 |
+
# 在界面上显示图片
|
16 |
+
st.image(image, caption="上传的图片", use_column_width=True)
|
17 |
+
|
18 |
+
# 使用模型进行颜值打分
|
19 |
+
# score = model.predict(image)
|
20 |
+
score = 100
|
21 |
+
|
22 |
+
# 在界面上显示颜值分数
|
23 |
+
st.write("颜值打分:", score)
|
24 |
+
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
main()
|