Update app.py
Browse files
app.py
CHANGED
|
@@ -137,7 +137,7 @@ st.title("Hugging Face Agent and tools")
|
|
| 137 |
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.")
|
| 138 |
|
| 139 |
# Create a page with tabs
|
| 140 |
-
tabs = st.tabs(["Chat", "URL and
|
| 141 |
|
| 142 |
# Tab 1: Chat
|
| 143 |
with tabs[0]:
|
|
@@ -145,17 +145,7 @@ with tabs[0]:
|
|
| 145 |
# Code for URL and Tools checkboxes
|
| 146 |
|
| 147 |
# Examples for the user perspective
|
| 148 |
-
st.markdown("
|
| 149 |
-
st.markdown("1. **Generate a Random Character**:")
|
| 150 |
-
st.markdown(" - Choose the desired URL and the 'Random Character Tool'.")
|
| 151 |
-
|
| 152 |
-
st.markdown("2. **Sentiment Analysis**:")
|
| 153 |
-
st.markdown(" - Choose the desired URL and the 'Sentiment Analysis Tool'.")
|
| 154 |
-
st.markdown(" - Sample: What is the sentiment for \"Hello, I am happy\"?")
|
| 155 |
-
|
| 156 |
-
st.markdown("3. **Word Count**:")
|
| 157 |
-
st.markdown(" - Choose the desired URL and the 'Word Counter Tool'.")
|
| 158 |
-
st.markdown(" - Sample: Count the words in \"Hello, I am Christof\".")
|
| 159 |
|
| 160 |
|
| 161 |
# Tab 2: URL and Tools
|
|
@@ -163,18 +153,6 @@ with tabs[1]:
|
|
| 163 |
|
| 164 |
# Code for URL and Tools checkboxes
|
| 165 |
|
| 166 |
-
# Examples for the user perspective
|
| 167 |
-
st.markdown("### Examples:")
|
| 168 |
-
st.markdown("1. **Generate a Random Character**:")
|
| 169 |
-
st.markdown(" - Choose the desired URL and the 'Random Character Tool'.")
|
| 170 |
-
|
| 171 |
-
st.markdown("2. **Sentiment Analysis**:")
|
| 172 |
-
st.markdown(" - Choose the desired URL and the 'Sentiment Analysis Tool'.")
|
| 173 |
-
st.markdown(" - Sample: What is the sentiment for \"Hello, I am happy\"?")
|
| 174 |
-
|
| 175 |
-
st.markdown("3. **Word Count**:")
|
| 176 |
-
st.markdown(" - Choose the desired URL and the 'Word Counter Tool'.")
|
| 177 |
-
st.markdown(" - Sample: Count the words in \"Hello, I am Christof\".")
|
| 178 |
|
| 179 |
# Add a dropdown for selecting the inference URL
|
| 180 |
url_endpoint = st.selectbox("Select Inference URL", [
|
|
@@ -202,6 +180,7 @@ with tabs[2]:
|
|
| 202 |
## Examples
|
| 203 |
1. **Generate a Random Character**:
|
| 204 |
- Choose the desired URL and the 'Random Character Tool'.
|
|
|
|
| 205 |
|
| 206 |
2. **Sentiment Analysis**:
|
| 207 |
- Choose the desired URL and the 'Sentiment Analysis Tool'.
|
|
@@ -210,12 +189,23 @@ with tabs[2]:
|
|
| 210 |
3. **Word Count**:
|
| 211 |
- Choose the desired URL and the 'Word Counter Tool'.
|
| 212 |
- Sample: Count the words in "Hello, I am Christof".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
## Tools
|
| 215 |
To interact with the tools, expand the section below to see tool descriptions and select the tools you want to use.
|
| 216 |
|
| 217 |
-
|
| 218 |
-
<summary>Expand to see tool descriptions</summary>
|
| 219 |
|
| 220 |
### Tool Descriptions
|
| 221 |
- **random-character-tool:** Generates a random character.
|
|
@@ -234,8 +224,7 @@ with tabs[2]:
|
|
| 234 |
- **text-to-video:** Generates a video from text.
|
| 235 |
- **image-transformation:** Applies transformations to images.
|
| 236 |
- **latent-upscaler-tool:** Upscales images using latent space.
|
| 237 |
-
|
| 238 |
-
</details>
|
| 239 |
|
| 240 |
## Usage
|
| 241 |
1. Choose the desired inference URL from the dropdown.
|
|
|
|
| 137 |
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.")
|
| 138 |
|
| 139 |
# Create a page with tabs
|
| 140 |
+
tabs = st.tabs(["Chat", "URL, Tools and logging", "User Description", "Developers"])
|
| 141 |
|
| 142 |
# Tab 1: Chat
|
| 143 |
with tabs[0]:
|
|
|
|
| 145 |
# Code for URL and Tools checkboxes
|
| 146 |
|
| 147 |
# Examples for the user perspective
|
| 148 |
+
st.markdown("Stat to chat. e.g. Generate an image of a boat. This will make the agent use the tool text2image to generate an image.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
# Tab 2: URL and Tools
|
|
|
|
| 153 |
|
| 154 |
# Code for URL and Tools checkboxes
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
# Add a dropdown for selecting the inference URL
|
| 158 |
url_endpoint = st.selectbox("Select Inference URL", [
|
|
|
|
| 180 |
## Examples
|
| 181 |
1. **Generate a Random Character**:
|
| 182 |
- Choose the desired URL and the 'Random Character Tool'.
|
| 183 |
+
- Then type 'Genarate random Character'
|
| 184 |
|
| 185 |
2. **Sentiment Analysis**:
|
| 186 |
- Choose the desired URL and the 'Sentiment Analysis Tool'.
|
|
|
|
| 189 |
3. **Word Count**:
|
| 190 |
- Choose the desired URL and the 'Word Counter Tool'.
|
| 191 |
- Sample: Count the words in "Hello, I am Christof".
|
| 192 |
+
|
| 193 |
+
Other samples:
|
| 194 |
+
|
| 195 |
+
- Generate a random character.
|
| 196 |
+
- What is the sentiment for "Hello I am happy"
|
| 197 |
+
- Count the words of "Hello I am Christof”
|
| 198 |
+
- What is the most downloaded model for text2image
|
| 199 |
+
- Use ner_tool to find the information in the following text:"Hello I am Christof.".
|
| 200 |
+
- Download the text from https://docs.streamlit.io/get-started/installation
|
| 201 |
+
- Scrape source code from https://docs.streamlit.io/get-started/installation
|
| 202 |
+
- label for text="Hello I am Christof" classifies greeting
|
| 203 |
+
|
| 204 |
|
| 205 |
## Tools
|
| 206 |
To interact with the tools, expand the section below to see tool descriptions and select the tools you want to use.
|
| 207 |
|
| 208 |
+
Expand to see tool descriptions
|
|
|
|
| 209 |
|
| 210 |
### Tool Descriptions
|
| 211 |
- **random-character-tool:** Generates a random character.
|
|
|
|
| 224 |
- **text-to-video:** Generates a video from text.
|
| 225 |
- **image-transformation:** Applies transformations to images.
|
| 226 |
- **latent-upscaler-tool:** Upscales images using latent space.
|
| 227 |
+
|
|
|
|
| 228 |
|
| 229 |
## Usage
|
| 230 |
1. Choose the desired inference URL from the dropdown.
|