Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ from app_dev_desc import app_dev_desc
|
|
7 |
from logger import log_response
|
8 |
from logger import log_enabled
|
9 |
from app_chat import app_chat
|
|
|
10 |
|
11 |
from app_agent_config import AgentConfig
|
12 |
|
@@ -32,33 +33,48 @@ st.markdown("Welcome to the Hugging Face Agent and Tools app! This app allows yo
|
|
32 |
import pandas as pd
|
33 |
from io import StringIO
|
34 |
with st.sidebar:
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
if uploaded_file is not None:
|
38 |
# To read file as bytes:
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
# To convert to a string based IO:
|
43 |
-
stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
44 |
-
st.write(stringio)
|
45 |
|
46 |
# To read file as string:
|
47 |
-
string_data = stringio.read()
|
48 |
-
st.write(string_data)
|
49 |
|
50 |
# Can be used wherever a "file-like" object is accepted:
|
51 |
dataframe = pd.read_csv(uploaded_file)
|
52 |
st.write(dataframe)
|
53 |
|
54 |
|
55 |
-
img_file_buffer = st.file_uploader('Upload a PNG image', type='png')
|
56 |
-
if img_file_buffer is not None:
|
57 |
-
image = Image.open(img_file_buffer)
|
58 |
-
img_array = np.array(image)
|
59 |
-
########
|
60 |
-
image
|
61 |
-
st.image(img_array)
|
62 |
|
63 |
# Create a page with tabs
|
64 |
tabs = st.tabs(["Chat", "URL, Tools and logging", "User Description", "Developers"])
|
|
|
7 |
from logger import log_response
|
8 |
from logger import log_enabled
|
9 |
from app_chat import app_chat
|
10 |
+
import numpy as np
|
11 |
|
12 |
from app_agent_config import AgentConfig
|
13 |
|
|
|
33 |
import pandas as pd
|
34 |
from io import StringIO
|
35 |
with st.sidebar:
|
36 |
+
|
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 |
+
image = np.array(image_raw)
|
41 |
+
########
|
42 |
+
st.image(image)
|
43 |
+
|
44 |
+
uploaded_file = st.file_uploader("Choose a file", type='pdf')
|
45 |
if uploaded_file is not None:
|
46 |
# To read file as bytes:
|
47 |
+
pdf_document = uploaded_file.getvalue()
|
48 |
+
document = pdf_document
|
49 |
+
st.write(pdf_document)
|
50 |
+
|
51 |
+
uploaded_txt_file = st.file_uploader("Choose a file", type='txt')
|
52 |
+
if uploaded_txt_file is not None:
|
53 |
+
# To read file as bytes:
|
54 |
+
txt_document = uploaded_txt_file.getvalue()
|
55 |
+
document = txt_document
|
56 |
+
st.write(txt_document)
|
57 |
+
|
58 |
+
uploaded_csv_file = st.file_uploader("Choose a file", type='csv')
|
59 |
+
if uploaded_csv_file is not None:
|
60 |
+
# To read file as bytes:
|
61 |
+
csv_document = uploaded_csv_file.getvalue()
|
62 |
+
document = csv_document
|
63 |
+
st.write(csv_document)
|
64 |
|
65 |
# To convert to a string based IO:
|
66 |
+
#stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
67 |
+
#st.write(stringio)
|
68 |
|
69 |
# To read file as string:
|
70 |
+
#string_data = stringio.read()
|
71 |
+
#st.write(string_data)
|
72 |
|
73 |
# Can be used wherever a "file-like" object is accepted:
|
74 |
dataframe = pd.read_csv(uploaded_file)
|
75 |
st.write(dataframe)
|
76 |
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
# Create a page with tabs
|
80 |
tabs = st.tabs(["Chat", "URL, Tools and logging", "User Description", "Developers"])
|