Spaces:
Running
Running
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) | |