ashhadahsan commited on
Commit
0d9a19b
β€’
1 Parent(s): e1d0c26

Create 2_🌍_trainui.py

Browse files
Files changed (1) hide show
  1. pages/2_🌍_trainui.py +34 -0
pages/2_🌍_trainui.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import time
4
+ from streamlit_extras.streaming_write import write
5
+
6
+
7
+ def stream_example():
8
+ for word in data.split():
9
+ yield word + " "
10
+ time.sleep(0.5)
11
+
12
+
13
+ st.set_page_config(layout="wide", page_title="Amazon Review | Trainer")
14
+ st.title("Amazon Review Trainer-Just a mock UI ")
15
+
16
+
17
+ data_upload = st.file_uploader(label="Train File", type=["xlsx", "csv", "xls"])
18
+
19
+ col1, col2 = st.columns([1, 1])
20
+ with col1:
21
+ theme = st.checkbox(label="Theme")
22
+ with col2:
23
+ subtheme = st.checkbox(label="Subtheme")
24
+
25
+
26
+ if data_upload is not None:
27
+ if data_upload.name.split(".")[-1] in ["xls", "xlsx"]:
28
+ df = pd.read_excel(io=data_upload, engine="openpyxl")
29
+ if data_upload.name.split(".")[-1] in ["csv"]:
30
+ df = pd.read_csv(filepath_or_buffer=data_upload)
31
+ df.columns = [x.lower() for x in df.columns.tolist()]
32
+ data = ",".join(df.columns.values.tolist())
33
+ # st.write(data)
34
+ write(stream_example)