-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdashboard.py
29 lines (23 loc) · 881 Bytes
/
dashboard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
from utils import read_logs
from wordcloud import WordCloud
import matplotlib.pyplot as plt
st.set_page_config(layout="wide")
if __name__ == "__main__":
st.title("Dasboard DetectGPT")
data = read_logs()
col_1, col_2 = st.columns(2)
with col_1:
st.subheader("Score Distribution")
temp_df = data[['timestamp', 'score']]
temp_df = temp_df.rename(columns = {"timestamp" : "index"}).set_index('index')
st.line_chart(temp_df, height = 455)
with col_2:
st.subheader("Text Frequency")
list_free_text = " ".join(data['text_input'].tolist())
wordcloud = WordCloud(background_color = "white", max_words = 50)
wordcloud.generate(list_free_text)
fig, ax = plt.subplots()
ax.imshow(wordcloud, interpolation = "bilinear")
ax.axis("off")
st.pyplot(fig)