Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ from transformers import pipeline
|
|
2 |
import matplotlib.pyplot as plt
|
3 |
import streamlit as st
|
4 |
from PIL import Image
|
|
|
|
|
5 |
|
6 |
|
7 |
|
@@ -56,6 +58,7 @@ if file_name is not None:
|
|
56 |
plt.tight_layout()
|
57 |
plt.show()
|
58 |
|
|
|
59 |
# 识别每个人的表情
|
60 |
output_list = []
|
61 |
|
@@ -80,8 +83,25 @@ if file_name is not None:
|
|
80 |
labels = list(label_counts.keys())
|
81 |
sizes = list(label_counts.values())
|
82 |
|
83 |
-
plt.
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
plt.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import matplotlib.pyplot as plt
|
3 |
import streamlit as st
|
4 |
from PIL import Image
|
5 |
+
import pandas as pd
|
6 |
+
import numpy as np
|
7 |
|
8 |
|
9 |
|
|
|
58 |
plt.tight_layout()
|
59 |
plt.show()
|
60 |
|
61 |
+
|
62 |
# 识别每个人的表情
|
63 |
output_list = []
|
64 |
|
|
|
83 |
labels = list(label_counts.keys())
|
84 |
sizes = list(label_counts.values())
|
85 |
|
86 |
+
fig, ax = plt.subplots()
|
87 |
+
fig.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)
|
88 |
+
fig.title('Distribution of Labels')
|
89 |
+
fig.axis('equal') # 确保饼状图为圆形
|
90 |
+
# plt.show()
|
91 |
+
|
92 |
+
|
93 |
+
# chart_data = pd.DataFrame(
|
94 |
+
# {
|
95 |
+
# "col1": list(range(20)),
|
96 |
+
# "col2": np.random.randn(20),
|
97 |
+
# "col3": np.random.randn(20),
|
98 |
+
# }
|
99 |
+
# )
|
100 |
+
|
101 |
+
# st.bar_chart(
|
102 |
+
# chart_data,
|
103 |
+
# x="col1",
|
104 |
+
# y=["col2", "col3"],
|
105 |
+
# color=["#FF0000", "#0000FF"], # Optional
|
106 |
+
# )
|
107 |
+
st.pyplot(fig)
|