File size: 967 Bytes
0d9a19b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
import streamlit as st
import pandas as pd
import time
from streamlit_extras.streaming_write import write


def stream_example():
    for word in data.split():
        yield word + " "
        time.sleep(0.5)


st.set_page_config(layout="wide", page_title="Amazon Review | Trainer")
st.title("Amazon Review  Trainer-Just a mock UI ")


data_upload = st.file_uploader(label="Train File", type=["xlsx", "csv", "xls"])

col1, col2 = st.columns([1, 1])
with col1:
    theme = st.checkbox(label="Theme")
with col2:
    subtheme = st.checkbox(label="Subtheme")


if data_upload is not None:
    if data_upload.name.split(".")[-1] in ["xls", "xlsx"]:
        df = pd.read_excel(io=data_upload, engine="openpyxl")
    if data_upload.name.split(".")[-1] in ["csv"]:
        df = pd.read_csv(filepath_or_buffer=data_upload)
    df.columns = [x.lower() for x in df.columns.tolist()]
    data = ",".join(df.columns.values.tolist())
    # st.write(data)
    write(stream_example)