blazingbunny commited on
Commit
e6dc0b7
·
1 Parent(s): 253188c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -4
app.py CHANGED
@@ -1,12 +1,32 @@
 
 
 
 
 
 
 
1
  def sample_analyze_entities(text_content):
2
  st.write("Debug: Entered sample_analyze_entities")
3
  try:
4
- # Your existing code to analyze entities goes here.
5
- # For example, making an API call:
6
  st.write("Debug: Making API call...")
7
- # response = your_api_call_here(text_content)
 
 
 
8
  st.write("Debug: API call completed.")
9
- # Process the response and display output
 
10
  # st.write(response)
11
  except Exception as e:
12
  st.write(f"Debug: An error occurred: {e}")
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+
4
+ # Read API key if stored as an env variable
5
+ api_key = os.environ.get("GOOGLE_API_KEY")
6
+
7
+ # Your existing function
8
  def sample_analyze_entities(text_content):
9
  st.write("Debug: Entered sample_analyze_entities")
10
  try:
11
+ # Placeholder: Your existing code to make Google Cloud NLP API call goes here
 
12
  st.write("Debug: Making API call...")
13
+
14
+ # Example: (Replace this with your actual API call)
15
+ # response = client.analyze_entities(...)
16
+
17
  st.write("Debug: API call completed.")
18
+
19
+ # Placeholder: Process the response and display output
20
  # st.write(response)
21
  except Exception as e:
22
  st.write(f"Debug: An error occurred: {e}")
23
+
24
+ # Streamlit UI
25
+ st.title('Google Cloud NLP Entity Analyzer')
26
+ user_input = st.text_area('Enter text to analyze', '')
27
+
28
+ if st.button('Analyze'):
29
+ st.write("Debug: Analyze button clicked")
30
+ if user_input:
31
+ st.write(f"Debug: User input received: {user_input}")
32
+ sample_analyze_entities(user_input)