File size: 1,278 Bytes
7d849d3
 
9830b8e
 
 
4b4013f
 
b16e227
9830b8e
 
b16e227
63e083c
b16e227
 
4b4013f
6a1c9b8
63e083c
4b4013f
6a1c9b8
4b4013f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
import streamlit as st

radioButtonList = ["E-commerce CSV (https://www.kaggle.com/datasets/mervemenekse/ecommerce-dataset)",
"Upload my own CSV",
"Upload my own PDF",
"URL Chat with Google Alphabet's 2022 Q2 Earnings Report (https://shorturl.at/csCK3)",
"Enter my own URL"]
genre = st.radio(
    "Choose dataset to finetune", radioButtonList
    )

if genre==radioButtonList[0]:
    st.write('You selected comedy.')
else:
    st.write(f'''Password streamlit app: {st.secrets["PSWD"]}''')

isCustomURL = genre==radioButtonList[4]
title = st.text_input('Enter your own URL', 'https://shorturl.at/csCK3', disabled=not isCustomURL)
st.write('The current movie title is', title)

isCustomPDF = genre==radioButtonList[2]
uploaded_file = st.file_uploader("Upload your own PDF here", disabled=not isCustomPDF)
if uploaded_file is not None:
    # To read file as bytes:
    bytes_data = uploaded_file.getvalue()
    st.write(bytes_data)

    # To convert to a string based IO:
    stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
    st.write(stringio)

    # To read file as string:
    string_data = stringio.read()
    st.write(string_data)

    # Can be used wherever a "file-like" object is accepted:
    dataframe = pd.read_csv(uploaded_file)
    st.write(dataframe)