Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import requests
|
|
3 |
import json
|
4 |
|
5 |
# Function to interact with Vectara API
|
6 |
-
def query_vectara(
|
7 |
api_endpoint = "https://api.vectara.io/v1/query"
|
8 |
customer_id = "<YOUR-CUSTOMER-ID>"
|
9 |
corpus_id = "<YOUR-CORPUS-ID>"
|
@@ -12,7 +12,7 @@ def query_vectara(query_str):
|
|
12 |
query_body = {
|
13 |
"query": [
|
14 |
{
|
15 |
-
"query":
|
16 |
"start": 0,
|
17 |
"numResults": 10,
|
18 |
"corpusKey": [
|
@@ -56,7 +56,7 @@ def query_vectara(query_str):
|
|
56 |
# Create a Gradio interface
|
57 |
iface = gr.Interface(
|
58 |
fn=query_vectara,
|
59 |
-
inputs=gr.inputs.
|
60 |
outputs=gr.outputs.JSON(),
|
61 |
live=True,
|
62 |
capture_session=True
|
|
|
3 |
import json
|
4 |
|
5 |
# Function to interact with Vectara API
|
6 |
+
def query_vectara(question):
|
7 |
api_endpoint = "https://api.vectara.io/v1/query"
|
8 |
customer_id = "<YOUR-CUSTOMER-ID>"
|
9 |
corpus_id = "<YOUR-CORPUS-ID>"
|
|
|
12 |
query_body = {
|
13 |
"query": [
|
14 |
{
|
15 |
+
"query": question, # Use the 'question' input as the query
|
16 |
"start": 0,
|
17 |
"numResults": 10,
|
18 |
"corpusKey": [
|
|
|
56 |
# Create a Gradio interface
|
57 |
iface = gr.Interface(
|
58 |
fn=query_vectara,
|
59 |
+
inputs=gr.inputs.Text(label="Ask a question:"),
|
60 |
outputs=gr.outputs.JSON(),
|
61 |
live=True,
|
62 |
capture_session=True
|