david-oplatka commited on
Commit
156af69
·
verified ·
1 Parent(s): 8a84ded

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -3,16 +3,14 @@ from query import VectaraQuery
3
  import os
4
  import gradio as gr
5
 
6
-
7
  def isTrue(x) -> bool:
8
  if isinstance(x, bool):
9
  return x
10
  return x.strip().lower() == 'true'
11
 
12
- corpus_ids = str(os.environ['corpus_ids']).split(',')
13
  cfg = OmegaConf.create({
14
- 'customer_id': str(os.environ['customer_id']),
15
- 'corpus_ids': corpus_ids,
16
  'api_key': str(os.environ['api_key']),
17
  'title': os.environ['title'],
18
  'description': os.environ['description'],
@@ -22,7 +20,7 @@ cfg = OmegaConf.create({
22
  'examples': os.environ.get('examples', None)
23
  })
24
 
25
- vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids, cfg.prompt_name)
26
 
27
  def respond(message, history):
28
  if cfg.streaming:
@@ -37,8 +35,8 @@ def respond(message, history):
37
  else:
38
  # Call non-stream response and return message output
39
  response = vq.submit_query(message)
40
- # yield response
41
- return response
42
 
43
  cfg.description = f'''
44
  <table>
 
3
  import os
4
  import gradio as gr
5
 
 
6
  def isTrue(x) -> bool:
7
  if isinstance(x, bool):
8
  return x
9
  return x.strip().lower() == 'true'
10
 
11
+ corpus_keys = str(os.environ['corpus_keys']).split(',')
12
  cfg = OmegaConf.create({
13
+ 'corpus_keys': corpus_keys,
 
14
  'api_key': str(os.environ['api_key']),
15
  'title': os.environ['title'],
16
  'description': os.environ['description'],
 
20
  'examples': os.environ.get('examples', None)
21
  })
22
 
23
+ vq = VectaraQuery(cfg.api_key, cfg.corpus_keys, cfg.prompt_name)
24
 
25
  def respond(message, history):
26
  if cfg.streaming:
 
35
  else:
36
  # Call non-stream response and return message output
37
  response = vq.submit_query(message)
38
+ yield response
39
+
40
 
41
  cfg.description = f'''
42
  <table>