Spaces:
Build error
Build error
Commit
·
c5e9bcf
1
Parent(s):
e67172f
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,39 @@ import streamlit as st
|
|
3 |
from google.oauth2 import service_account
|
4 |
from google.cloud import language_v1
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# Header and intro
|
7 |
st.title("Google Cloud NLP Entity Analyzer")
|
8 |
st.write("## Introduction to the Knowledge Graph API")
|
|
|
3 |
from google.oauth2 import service_account
|
4 |
from google.cloud import language_v1
|
5 |
|
6 |
+
# Sidebar content
|
7 |
+
st.sidebar.title("About This Tool")
|
8 |
+
|
9 |
+
st.sidebar.markdown("### Descriptive Introduction")
|
10 |
+
st.sidebar.markdown("""
|
11 |
+
The "Google Cloud NLP Entity Analyzer" is a powerful tool designed to analyze text and identify various types of entities such as people, locations, organizations, and events. Leveraging Google's Natural Language Processing (NLP) technology, this tool provides insights into how Google understands text, which can be particularly useful for Search Engine Optimization (SEO) efforts. It also serves as an interface to the Google Knowledge Graph API, providing additional contextual information about the identified entities.
|
12 |
+
|
13 |
+
The application is built with Streamlit and interfaces with Google's Cloud NLP API to conduct the entity analysis. It allows users to enter text and an optional query, performs the analysis, and then displays the results in an easy-to-read format. The output includes the type of the entity, its relevance score (salience), and any metadata associated with it.
|
14 |
+
""")
|
15 |
+
|
16 |
+
st.sidebar.markdown("### Step-by-Step Guide")
|
17 |
+
st.sidebar.markdown("""
|
18 |
+
1. **Open the Tool**: Navigate to the URL where the tool is hosted.
|
19 |
+
2. **User Input**:
|
20 |
+
- **Text to Analyze**: In the text area labeled "Enter text to analyze", paste or type the text you want to analyze.
|
21 |
+
- **Query**: Optionally, you can also enter a specific query in the text input field labeled "Enter your query (optional)". This is for your own reference.
|
22 |
+
- **Analyze**: Click the button labeled "Analyze". The tool will then process the text and perform entity analysis on it.
|
23 |
+
3. **View Results**:
|
24 |
+
- After the analysis is complete, you'll see a section that says, "We found X results for your query of your_query" (or just "We found results for your query" if no query was entered).
|
25 |
+
- Below this, you'll find a line-by-line breakdown of each entity identified in the text.
|
26 |
+
4. **Interpreting the Output**: Each entity will be displayed with the following information:
|
27 |
+
- **Relevance Score**: A score indicating how relevant the entity is within the text.
|
28 |
+
- **Name**: The name of the entity.
|
29 |
+
- **Type**: The type of entity (e.g., PERSON, ORGANIZATION).
|
30 |
+
- **Salience Score**: A score indicating the entity's importance or centrality in the text.
|
31 |
+
- **Metadata**: Additional data associated with the entity.
|
32 |
+
- **Mentions**: Instances where the entity is mentioned in the text.
|
33 |
+
- **Knowledge Graph Information**: For each entity, additional information from the Google Knowledge Graph will be displayed, providing more context about the entity.
|
34 |
+
5. **Language of the Text**: At the bottom, the tool will also display the language in which the text is written.
|
35 |
+
|
36 |
+
And that's it! You can now easily analyze text for entities and get insights into how Google understands the content.
|
37 |
+
""")
|
38 |
+
|
39 |
# Header and intro
|
40 |
st.title("Google Cloud NLP Entity Analyzer")
|
41 |
st.write("## Introduction to the Knowledge Graph API")
|