Chris4K commited on
Commit
e8f0d97
·
verified ·
1 Parent(s): 8228362

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -10
app.py CHANGED
@@ -86,10 +86,21 @@ def load_tools(tool_names):
86
  tool_names = [
87
  "Chris4K/random-character-tool",
88
  "Chris4K/text-generation-tool",
89
- #"Chris4K/sentiment-tool",
90
- "Chris4K/EmojifyTextTool",
91
-
92
- # Add other tool names as needed
 
 
 
 
 
 
 
 
 
 
 
93
  ]
94
 
95
  # Create tool loader instance
@@ -112,6 +123,9 @@ def handle_submission(user_message, selected_tools):
112
 
113
  st.title("Hugging Face Agent and tools")
114
 
 
 
 
115
  if "messages" not in st.session_state:
116
  st.session_state.messages = []
117
 
@@ -119,7 +133,6 @@ for message in st.session_state.messages:
119
  with st.chat_message(message["role"]):
120
  st.markdown(message["content"])
121
 
122
- tool_checkboxes = [st.checkbox(f"{tool.name} --- {tool.description} ") for tool in tool_loader.tools]
123
 
124
  with st.chat_message("assistant"):
125
  st.markdown("Hello there! How can I assist you today?")
@@ -154,15 +167,15 @@ if user_message := st.chat_input("Enter message"):
154
  st.table(response.iloc[0:10])
155
  elif isinstance(response, dict):
156
  st.json(response)
157
- elif isinstance(response, streamlit.graphics_altair.AltairChart):
158
  st.altair_chart(response)
159
- elif isinstance(response, streamlit.graphics_bokeh.BokehChart):
160
  st.bokeh_chart(response)
161
- elif isinstance(response, streamlit.graphics_graphviz.GraphvizChart):
162
  st.graphviz_chart(response)
163
- elif isinstance(response, streamlit.graphics_plotly.PlotlyChart):
164
  st.plotly_chart(response)
165
- elif isinstance(response, streamlit.graphics_pydeck.PydeckChart):
166
  st.pydeck_chart(response)
167
  elif isinstance(response, matplotlib.figure.Figure):
168
  st.pyplot(response)
 
86
  tool_names = [
87
  "Chris4K/random-character-tool",
88
  "Chris4K/text-generation-tool",
89
+ "Chris4K/sentiment-tool",
90
+ "Chris4K/token-counter-tool",
91
+ "Chris4K/most-downloaded-model",
92
+ "Chris4K/rag-tool",
93
+ "Chris4K/word-counter-tool",
94
+ "Chris4K/sentence-counter-tool",
95
+ "Chris4K/EmojifyTextTool",
96
+ "Chris4K/NamedEntityRecognitionTool",
97
+ "Chris4K/TextDownloadTool",
98
+ "Chris4K/source-code-retriever-tool",
99
+ "Chris4K/text-to-image",
100
+ "Chris4K/text-to-video",
101
+ "Chris4K/image-transformation",
102
+ "Chris4K/latent-upscaler-tool"
103
+ # More cool tools to come
104
  ]
105
 
106
  # Create tool loader instance
 
123
 
124
  st.title("Hugging Face Agent and tools")
125
 
126
+ tool_checkboxes = [st.checkbox(f"{tool.name} --- {tool.description} ") for tool in tool_loader.tools]
127
+
128
+
129
  if "messages" not in st.session_state:
130
  st.session_state.messages = []
131
 
 
133
  with st.chat_message(message["role"]):
134
  st.markdown(message["content"])
135
 
 
136
 
137
  with st.chat_message("assistant"):
138
  st.markdown("Hello there! How can I assist you today?")
 
167
  st.table(response.iloc[0:10])
168
  elif isinstance(response, dict):
169
  st.json(response)
170
+ elif isinstance(response, st.graphics_altair.AltairChart):
171
  st.altair_chart(response)
172
+ elif isinstance(response, st.graphics_bokeh.BokehChart):
173
  st.bokeh_chart(response)
174
+ elif isinstance(response, st.graphics_graphviz.GraphvizChart):
175
  st.graphviz_chart(response)
176
+ elif isinstance(response, st.graphics_plotly.PlotlyChart):
177
  st.plotly_chart(response)
178
+ elif isinstance(response, st.graphics_pydeck.PydeckChart):
179
  st.pydeck_chart(response)
180
  elif isinstance(response, matplotlib.figure.Figure):
181
  st.pyplot(response)