Update app.py
Browse files
app.py
CHANGED
@@ -151,18 +151,43 @@ def create_annotated_text(original_text, word_results):
|
|
151 |
def create_interface():
|
152 |
with gr.Blocks(title="Google Cloud Natural Language Classifier") as app:
|
153 |
gr.Markdown("""
|
154 |
-
# Google Cloud Natural Language Text Classifier
|
155 |
|
156 |
-
This
|
157 |
|
158 |
-
|
159 |
-
1. Set up Google Cloud credentials as environment variable `GOOGLE_APPLICATION_CREDENTIALS_JSON`
|
160 |
-
2. Enable the Natural Language API in your Google Cloud project
|
161 |
|
162 |
-
**
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
""")
|
167 |
|
168 |
with gr.Row():
|
|
|
151 |
def create_interface():
|
152 |
with gr.Blocks(title="Google Cloud Natural Language Classifier") as app:
|
153 |
gr.Markdown("""
|
154 |
+
# Google Cloud Natural Language Text Classifier (V2 Model)
|
155 |
|
156 |
+
This intelligent text classification tool leverages Google Cloud's powerful Natural Language API V2 model to analyze and categorize your content with high accuracy and confidence scores.
|
157 |
|
158 |
+
## How to Use This Tool
|
|
|
|
|
159 |
|
160 |
+
1. **Enter Your Text**: Type or paste any paragraph, article excerpt, or text content into the input box on the left
|
161 |
+
2. **Click "Analyze Text"**: Hit the analyze button to process your content
|
162 |
+
3. **Review Results**: The tool provides three types of analysis:
|
163 |
+
- **Word-Level Classification**: Each unique word gets categorized individually with confidence scores
|
164 |
+
- **Annotated Text**: Your original text with inline category labels and confidence scores
|
165 |
+
- **Paragraph-Level Classification**: The entire text analyzed as a cohesive unit
|
166 |
+
|
167 |
+
## What You'll Get
|
168 |
+
|
169 |
+
- **Detailed Categories**: Content is classified into specific categories like `/Arts & Entertainment/Movies`, `/Business & Industrial/Finance`, `/Health/Medical`, etc.
|
170 |
+
- **Confidence Scores**: Each classification includes a confidence score (0-1) indicating how certain the AI is about the categorization
|
171 |
+
- **Multiple Classifications**: Words and paragraphs can belong to multiple categories simultaneously
|
172 |
+
- **Comprehensive Analysis**: Both granular (word-level) and holistic (paragraph-level) insights
|
173 |
+
|
174 |
+
## Perfect For
|
175 |
+
|
176 |
+
- Content creators organizing their material
|
177 |
+
- Researchers analyzing text themes
|
178 |
+
- Marketers understanding content categories
|
179 |
+
- Students exploring text classification
|
180 |
+
- Anyone curious about how AI categorizes written content
|
181 |
+
|
182 |
+
## Powered By
|
183 |
+
|
184 |
+
This tool uses Google Cloud's Natural Language API V2 model for superior performance and accuracy. The V2 model supports an expanded set of content categories for more precise classification.
|
185 |
+
|
186 |
+
**Source**: [Google Cloud Natural Language API - Content Categories](https://cloud.google.com/natural-language/docs/categories#version_2)
|
187 |
+
|
188 |
+
---
|
189 |
+
|
190 |
+
**Try the examples below or enter your own text to get started!**
|
191 |
""")
|
192 |
|
193 |
with gr.Row():
|