Chris4K commited on
Commit
8d7bc1b
·
verified ·
1 Parent(s): 3cf4e49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -37
app.py CHANGED
@@ -35,47 +35,48 @@ from io import StringIO
35
  with st.sidebar:
36
  with st.expander("Set content and context"):
37
  img_file_buffer = st.file_uploader('Upload a PNG image', type='png')
38
- if img_file_buffer is not None:
39
- image_raw = Image.open(img_file_buffer)
40
- #global image
41
- agent_config.image = np.array(image_raw)
42
- ########
43
- st.image(agent_config.image)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- uploaded_file = st.file_uploader("Choose a file", type='pdf')
46
- if uploaded_file is not None:
47
- # To read file as bytes:
48
- pdf_document = uploaded_file.getvalue()
49
- global document
50
- agent_config.document = pdf_document
51
- st.write(pdf_document)
52
 
53
- uploaded_txt_file = st.file_uploader("Choose a file", type='txt')
54
- if uploaded_txt_file is not None:
55
- # To read file as bytes:
56
- txt_document = uploaded_txt_file.getvalue()
57
- agent_config.document = txt_document
58
- st.write(txt_document)
59
 
60
- uploaded_csv_file = st.file_uploader("Choose a file", type='csv')
61
- if uploaded_csv_file is not None:
62
- # To read file as bytes:
63
- csv_document = uploaded_csv_file.getvalue()
64
- agent_config.document = csv_document
65
- st.write(csv_document)
66
 
67
- # To convert to a string based IO:
68
- #stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
69
- #st.write(stringio)
70
-
71
- # To read file as string:
72
- #string_data = stringio.read()
73
- #st.write(string_data)
74
-
75
- # Can be used wherever a "file-like" object is accepted:
76
- dataframe = pd.read_csv(uploaded_file)
77
- st.write(dataframe)
78
-
79
 
80
 
81
  # Create a page with tabs
 
35
  with st.sidebar:
36
  with st.expander("Set content and context"):
37
  img_file_buffer = st.file_uploader('Upload a PNG image', type='png')
38
+
39
+ if img_file_buffer is not None:
40
+ image_raw = Image.open(img_file_buffer)
41
+ #global image
42
+ agent_config.image = np.array(image_raw)
43
+ ########
44
+ st.image(agent_config.image)
45
+
46
+ uploaded_file = st.file_uploader("Choose a file", type='pdf')
47
+ if uploaded_file is not None:
48
+ # To read file as bytes:
49
+ pdf_document = uploaded_file.getvalue()
50
+ global document
51
+ agent_config.document = pdf_document
52
+ st.write(pdf_document)
53
+
54
+ uploaded_txt_file = st.file_uploader("Choose a file", type='txt')
55
+ if uploaded_txt_file is not None:
56
+ # To read file as bytes:
57
+ txt_document = uploaded_txt_file.getvalue()
58
+ agent_config.document = txt_document
59
+ st.write(txt_document)
60
+
61
+ uploaded_csv_file = st.file_uploader("Choose a file", type='csv')
62
+ if uploaded_csv_file is not None:
63
+ # To read file as bytes:
64
+ csv_document = uploaded_csv_file.getvalue()
65
+ agent_config.document = csv_document
66
+ st.write(csv_document)
67
 
68
+ # To convert to a string based IO:
69
+ #stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
70
+ #st.write(stringio)
 
 
 
 
71
 
72
+ # To read file as string:
73
+ #string_data = stringio.read()
74
+ #st.write(string_data)
 
 
 
75
 
76
+ # Can be used wherever a "file-like" object is accepted:
77
+ dataframe = pd.read_csv(uploaded_file)
78
+ st.write(dataframe)
 
 
 
79
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
 
82
  # Create a page with tabs