cyberandy commited on
Commit
eef03e6
·
1 Parent(s): 4845500

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,7 +1,9 @@
1
  import streamlit as st
2
  import requests
3
 
4
- def call_api(url, keyword, wl_key, description_narrative, secret_key):
 
 
5
  api_url = "https://wl-quality-rating.eastus2.inference.ml.azure.com/score"
6
 
7
  payload = {
@@ -14,7 +16,7 @@ def call_api(url, keyword, wl_key, description_narrative, secret_key):
14
  headers = {
15
  "Content-Type": "application/json",
16
  "User-Agent": "insomnia/8.2.0",
17
- "Authorization": "Bearer " + st.secrets["secret_key"]
18
  }
19
 
20
  response = requests.request("POST", api_url, json=payload, headers=headers)
@@ -28,8 +30,8 @@ wordlift_key = st.text_input("Enter the WordLift Key:")
28
 
29
  # Button to execute analysis
30
  if st.button("Analyze"):
31
- if url and query and narrative and wordlift_key and secret_key:
32
- response = call_api(url, query, wordlift_key, narrative, secret_key)
33
 
34
  # Display JSON response
35
  st.json(response)
 
1
  import streamlit as st
2
  import requests
3
 
4
+ secret_key = st.secrets["secret_key"]
5
+
6
+ def call_api(url, keyword, wl_key, description_narrative):
7
  api_url = "https://wl-quality-rating.eastus2.inference.ml.azure.com/score"
8
 
9
  payload = {
 
16
  headers = {
17
  "Content-Type": "application/json",
18
  "User-Agent": "insomnia/8.2.0",
19
+ "Authorization": "Bearer " + secret_key
20
  }
21
 
22
  response = requests.request("POST", api_url, json=payload, headers=headers)
 
30
 
31
  # Button to execute analysis
32
  if st.button("Analyze"):
33
+ if url and query and narrative and wordlift_key:
34
+ response = call_api(url, query, wordlift_key, narrative)
35
 
36
  # Display JSON response
37
  st.json(response)