Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ st.title("Hugging Face Agent and tools")
|
|
| 26 |
|
| 27 |
## LB https://huggingface.co/spaces/qiantong-xu/toolbench-leaderboard
|
| 28 |
|
| 29 |
-
st.markdown("Welcome to the Hugging Face Agent and Tools app! This app allows you to interact with various tools using the Hugging Face API.")
|
| 30 |
|
| 31 |
#######
|
| 32 |
|
|
@@ -35,6 +35,7 @@ from io import StringIO
|
|
| 35 |
with st.sidebar:
|
| 36 |
with st.expander("Configure the agent and activate tools"):
|
| 37 |
|
|
|
|
| 38 |
agent_config.configure()
|
| 39 |
|
| 40 |
with st.expander("Set content and context"):
|
|
@@ -52,27 +53,41 @@ with st.sidebar:
|
|
| 52 |
########
|
| 53 |
st.image(agent_config.image)
|
| 54 |
|
| 55 |
-
uploaded_file = st.file_uploader("Choose a
|
| 56 |
if uploaded_file is not None:
|
| 57 |
# To read file as bytes:
|
| 58 |
pdf_document = uploaded_file.getvalue()
|
| 59 |
agent_config.document = pdf_document
|
| 60 |
st.write(pdf_document)
|
| 61 |
|
| 62 |
-
uploaded_txt_file = st.file_uploader("Choose a
|
| 63 |
if uploaded_txt_file is not None:
|
| 64 |
# To read file as bytes:
|
| 65 |
txt_document = uploaded_txt_file.getvalue()
|
| 66 |
agent_config.document = txt_document
|
| 67 |
st.write(txt_document)
|
| 68 |
|
| 69 |
-
uploaded_csv_file = st.file_uploader("Choose a
|
| 70 |
if uploaded_csv_file is not None:
|
| 71 |
# To read file as bytes:
|
| 72 |
csv_document = uploaded_csv_file.getvalue()
|
| 73 |
agent_config.document = csv_document
|
| 74 |
st.write(csv_document)
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# To convert to a string based IO:
|
| 77 |
#stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
| 78 |
#st.write(stringio)
|
|
|
|
| 26 |
|
| 27 |
## LB https://huggingface.co/spaces/qiantong-xu/toolbench-leaderboard
|
| 28 |
|
| 29 |
+
st.markdown("Welcome to the Hugging Face Agent and Tools app! This app allows you to interact with various tools using the Hugging Face API. CustomTransformers can do anything \n🤪🤗😄🤗🤪.")
|
| 30 |
|
| 31 |
#######
|
| 32 |
|
|
|
|
| 35 |
with st.sidebar:
|
| 36 |
with st.expander("Configure the agent and activate tools"):
|
| 37 |
|
| 38 |
+
st.header("Set Tools and Option. Context and Content.")
|
| 39 |
agent_config.configure()
|
| 40 |
|
| 41 |
with st.expander("Set content and context"):
|
|
|
|
| 53 |
########
|
| 54 |
st.image(agent_config.image)
|
| 55 |
|
| 56 |
+
uploaded_file = st.file_uploader("Choose a pdf", type='pdf')
|
| 57 |
if uploaded_file is not None:
|
| 58 |
# To read file as bytes:
|
| 59 |
pdf_document = uploaded_file.getvalue()
|
| 60 |
agent_config.document = pdf_document
|
| 61 |
st.write(pdf_document)
|
| 62 |
|
| 63 |
+
uploaded_txt_file = st.file_uploader("Choose a txt", type='txt')
|
| 64 |
if uploaded_txt_file is not None:
|
| 65 |
# To read file as bytes:
|
| 66 |
txt_document = uploaded_txt_file.getvalue()
|
| 67 |
agent_config.document = txt_document
|
| 68 |
st.write(txt_document)
|
| 69 |
|
| 70 |
+
uploaded_csv_file = st.file_uploader("Choose a csv", type='csv')
|
| 71 |
if uploaded_csv_file is not None:
|
| 72 |
# To read file as bytes:
|
| 73 |
csv_document = uploaded_csv_file.getvalue()
|
| 74 |
agent_config.document = csv_document
|
| 75 |
st.write(csv_document)
|
| 76 |
+
|
| 77 |
+
uploaded_csv_file = st.file_uploader("Choose audio", type='wav')
|
| 78 |
+
if uploaded_csv_file is not None:
|
| 79 |
+
# To read file as bytes:
|
| 80 |
+
csv_document = uploaded_csv_file.getvalue()
|
| 81 |
+
agent_config.document = csv_document
|
| 82 |
+
st.write(csv_document)
|
| 83 |
+
|
| 84 |
+
uploaded_csv_file = st.file_uploader("Choose video", type='avi')
|
| 85 |
+
if uploaded_csv_file is not None:
|
| 86 |
+
# To read file as bytes:
|
| 87 |
+
csv_document = uploaded_csv_file.getvalue()
|
| 88 |
+
agent_config.document = csv_document
|
| 89 |
+
st.write(csv_document)
|
| 90 |
+
|
| 91 |
# To convert to a string based IO:
|
| 92 |
#stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
|
| 93 |
#st.write(stringio)
|