update
Browse files- view/app_sidebar.py +61 -61
view/app_sidebar.py
CHANGED
@@ -13,72 +13,72 @@ def app_sidebar(controller):
|
|
13 |
with st.expander("Set the Content and Context"):
|
14 |
content_and_context(controller.agent_config)
|
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 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
uploaded_txt_file = st.file_uploader("Choose a txt", type='txt')
|
50 |
-
if uploaded_txt_file is not None:
|
51 |
-
# To read file as bytes:
|
52 |
-
agent_config.document = uploaded_txt_file.getvalue()
|
53 |
-
st.write(agent_config.document)
|
54 |
-
|
55 |
-
uploaded_csv_file = st.file_uploader("Choose a csv", type='csv')
|
56 |
-
if uploaded_csv_file is not None:
|
57 |
-
# To read file as bytes:
|
58 |
-
agent_config.document = uploaded_csv_file.getvalue()
|
59 |
-
st.write(agent_config.document)
|
60 |
-
|
61 |
-
uploaded_csv_file = st.file_uploader("Choose audio", type='wav')
|
62 |
-
if uploaded_csv_file is not None:
|
63 |
-
# To read file as bytes:
|
64 |
-
agent_config.document = uploaded_csv_file.getvalue()
|
65 |
-
st.write(agent_config.document)
|
66 |
-
|
67 |
-
uploaded_csv_file = st.file_uploader("Choose video", type='avi')
|
68 |
-
if uploaded_csv_file is not None:
|
69 |
-
# To read file as bytes:
|
70 |
-
agent_config.document = uploaded_csv_file.getvalue()
|
71 |
-
st.write(agent_config.document)
|
72 |
-
|
73 |
-
# To convert to a string based IO:
|
74 |
-
#stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
75 |
-
#st.write(stringio)
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
|
|
13 |
with st.expander("Set the Content and Context"):
|
14 |
content_and_context(controller.agent_config)
|
15 |
|
16 |
+
def configure(agent_config):
|
17 |
+
st.markdown("Change the agent's configuration here.")
|
18 |
|
19 |
+
agent_config.url_endpoint = st.selectbox("Select Inference URL", [
|
20 |
+
"https://api-inference.huggingface.co/models/bigcode/starcoder",
|
21 |
+
"https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
|
22 |
+
"https://api-inference.huggingface.co/models/gpt2"
|
23 |
+
])
|
24 |
+
|
25 |
+
agent_config.log_enabled = st.checkbox("Enable Logging")
|
26 |
|
27 |
+
agent_config.tool_checkboxes = [st.checkbox(f"{tool.name} --- {tool.description} ") for tool in agent_config.tool_loader.tools]
|
28 |
|
29 |
+
def content_and_context(agent_config):
|
30 |
+
agent_config.context = st.text_area("Context")
|
31 |
|
32 |
+
agent_config.image = st.camera_input("Take a picture")
|
33 |
|
34 |
+
img_file_buffer = st.file_uploader('Upload a PNG image', type='png')
|
35 |
+
|
36 |
+
if img_file_buffer is not None:
|
37 |
+
image_raw = Image.open(img_file_buffer)
|
38 |
+
#global image
|
39 |
+
agent_config.image = np.array(image_raw)
|
40 |
+
########
|
41 |
+
st.image(agent_config.image)
|
42 |
+
|
43 |
+
uploaded_file = st.file_uploader("Choose a pdf", type='pdf')
|
44 |
+
if uploaded_file is not None:
|
45 |
+
# To read file as bytes:
|
46 |
+
agent_config.document = uploaded_file.getvalue()
|
47 |
+
st.write(agent_config.document)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
+
uploaded_txt_file = st.file_uploader("Choose a txt", type='txt')
|
50 |
+
if uploaded_txt_file is not None:
|
51 |
+
# To read file as bytes:
|
52 |
+
agent_config.document = uploaded_txt_file.getvalue()
|
53 |
+
st.write(agent_config.document)
|
54 |
+
|
55 |
+
uploaded_csv_file = st.file_uploader("Choose a csv", type='csv')
|
56 |
+
if uploaded_csv_file is not None:
|
57 |
+
# To read file as bytes:
|
58 |
+
agent_config.document = uploaded_csv_file.getvalue()
|
59 |
+
st.write(agent_config.document)
|
60 |
+
|
61 |
+
uploaded_csv_file = st.file_uploader("Choose audio", type='wav')
|
62 |
+
if uploaded_csv_file is not None:
|
63 |
+
# To read file as bytes:
|
64 |
+
agent_config.document = uploaded_csv_file.getvalue()
|
65 |
+
st.write(agent_config.document)
|
66 |
|
67 |
+
uploaded_csv_file = st.file_uploader("Choose video", type='avi')
|
68 |
+
if uploaded_csv_file is not None:
|
69 |
+
# To read file as bytes:
|
70 |
+
agent_config.document = uploaded_csv_file.getvalue()
|
71 |
+
st.write(agent_config.document)
|
72 |
+
|
73 |
+
# To convert to a string based IO:
|
74 |
+
#stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
75 |
+
#st.write(stringio)
|
76 |
+
|
77 |
+
# To read file as string:
|
78 |
+
#string_data = stringio.read()
|
79 |
+
#st.write(string_data)
|
80 |
+
|
81 |
+
# Can be used wherever a "file-like" object is accepted:
|
82 |
+
dataframe = pd.read_csv(uploaded_file)
|
83 |
+
st.write(dataframe)
|
84 |
|