Upload Home.py
Browse files
Home.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from configs.db_configs import create_table, engine
|
| 3 |
+
import plotly.express as px
|
| 4 |
+
import pandas as pd
|
| 5 |
+
from streamlit.components.v1 import html
|
| 6 |
+
from configs.html_features import set_image
|
| 7 |
+
|
| 8 |
+
def main():
|
| 9 |
+
create_table()
|
| 10 |
+
st.title('Welcome to the Multi-purpose Text Application')
|
| 11 |
+
im1, im2, im3 = st.columns([1, 5.3, 1])
|
| 12 |
+
with im1:
|
| 13 |
+
pass
|
| 14 |
+
with im2:
|
| 15 |
+
url = "https://i.postimg.cc/jdF1hPng/combined.png"
|
| 16 |
+
html(set_image(url), height=500, width=500)
|
| 17 |
+
with im3:
|
| 18 |
+
pass
|
| 19 |
+
|
| 20 |
+
col11, col12, col13, col14 = st.columns([1, 2, 2, 1])
|
| 21 |
+
with col11:
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
with col12:
|
| 25 |
+
st.info('Text Summarizer')
|
| 26 |
+
|
| 27 |
+
with col13:
|
| 28 |
+
st.info('Text Analyzer')
|
| 29 |
+
|
| 30 |
+
with col14:
|
| 31 |
+
pass
|
| 32 |
+
|
| 33 |
+
col21, col22, col23, col24 = st.columns([1, 2, 2, 1])
|
| 34 |
+
with col21:
|
| 35 |
+
pass
|
| 36 |
+
|
| 37 |
+
with col22:
|
| 38 |
+
st.info('Text Translator')
|
| 39 |
+
|
| 40 |
+
with col23:
|
| 41 |
+
st.info('Topic Modeling')
|
| 42 |
+
|
| 43 |
+
with col24:
|
| 44 |
+
pass
|
| 45 |
+
|
| 46 |
+
plot1, plot2, plot3 = st.columns([5,1,5])
|
| 47 |
+
df = pd.read_sql('SELECT app from input_text', engine)['app'].value_counts().to_frame().reset_index()
|
| 48 |
+
df.columns = ['App', 'Frequency']
|
| 49 |
+
custom_color = px.colors.sequential.Blues_r
|
| 50 |
+
|
| 51 |
+
with plot1:
|
| 52 |
+
fig1 = px.pie(df, 'App', 'Frequency', title='The frequency of service usage as a percentage', width=400, height=500, color_discrete_sequence=custom_color)
|
| 53 |
+
fig1.update_layout(showlegend=False)
|
| 54 |
+
st.plotly_chart(fig1)
|
| 55 |
+
|
| 56 |
+
with plot2:
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
with plot3:
|
| 60 |
+
fig2 = px.area(df, 'App', 'Frequency', width=400, height=500, title='The frequency of service usage')
|
| 61 |
+
st.plotly_chart(fig2)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
if __name__ == '__main__':
|
| 65 |
+
main()
|