blazingbunny commited on
Commit
8c32010
·
1 Parent(s): 1d6d4f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -3,6 +3,22 @@ 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
+ # Adding checkbox options for entity types
7
+ entity_types_to_show = [
8
+ "UNKNOWN", "PERSON", "LOCATION", "ORGANIZATION", "EVENT", "WORK_OF_ART", "CONSUMER_GOOD", "OTHER"
9
+ ]
10
+ selected_types = st.multiselect('Select entity types to show:', entity_types_to_show)
11
+
12
+ def sample_analyze_entities(text_content, selected_types):
13
+ # Existing code for setting up credentials and client...
14
+
15
+ # Create an empty list to hold the results
16
+ entities_list = []
17
+
18
+ for entity in response.entities:
19
+ entity_type_name = language_v1.Entity.Type(entity.type_).name
20
+ if entity_type_name in selected_types:
21
+
22
  # Header and intro
23
  st.title("Google Cloud NLP Entity Analyzer")
24
  st.write("## Introduction to the Knowledge Graph API")