Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,8 @@ def query_vectara(question):
|
|
32 |
# Define the headers
|
33 |
api_key_header = {
|
34 |
"customer-id": CUSTOMER_ID,
|
35 |
-
"x-api-key": API_KEY
|
|
|
36 |
}
|
37 |
|
38 |
# Make the API request
|
@@ -40,8 +41,7 @@ def query_vectara(question):
|
|
40 |
"https://api.vectara.io/v1/query",
|
41 |
data=json.dumps(data_dict),
|
42 |
verify=True,
|
43 |
-
headers=api_key_header
|
44 |
-
headers={"Content-Type": "application/json"} # Set Content-Type header
|
45 |
)
|
46 |
|
47 |
if response.status_code == 200:
|
@@ -55,7 +55,7 @@ def query_vectara(question):
|
|
55 |
iface = gr.Interface(
|
56 |
fn=query_vectara,
|
57 |
inputs=[gr.Textbox(label="Input Text")],
|
58 |
-
outputs=gr.Textbox(label="Output Text"),
|
59 |
title="Vectara Chatbot",
|
60 |
description="Ask me anything using the Vectara API!"
|
61 |
)
|
|
|
32 |
# Define the headers
|
33 |
api_key_header = {
|
34 |
"customer-id": CUSTOMER_ID,
|
35 |
+
"x-api-key": API_KEY,
|
36 |
+
"Content-Type": "application/json" # Set Content-Type header
|
37 |
}
|
38 |
|
39 |
# Make the API request
|
|
|
41 |
"https://api.vectara.io/v1/query",
|
42 |
data=json.dumps(data_dict),
|
43 |
verify=True,
|
44 |
+
headers=api_key_header # Use the updated headers dictionary
|
|
|
45 |
)
|
46 |
|
47 |
if response.status_code == 200:
|
|
|
55 |
iface = gr.Interface(
|
56 |
fn=query_vectara,
|
57 |
inputs=[gr.Textbox(label="Input Text")],
|
58 |
+
outputs=[gr.Textbox(label="Output Text")],
|
59 |
title="Vectara Chatbot",
|
60 |
description="Ask me anything using the Vectara API!"
|
61 |
)
|