Tonic commited on
Commit
d87a29f
·
1 Parent(s): 2d46b21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,7 +3,7 @@ import requests
3
  import json
4
 
5
  # Function to interact with Vectara API
6
- def query_vectara(query_str):
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": query_str,
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.TextArea(label="Ask a question:"),
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