debisoft commited on
Commit
0b5db02
·
1 Parent(s): aa772bf
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -12,7 +12,10 @@ databricks_token = os.getenv('TENATCH_TOKEN')
12
  model_uri = "http://15.152.197.215/v1/completions"
13
 
14
  def extract_json(gen_text, n_shot_learning=0):
15
- start_index = gen_text.index("### Response:\n{") + 14
 
 
 
16
  if(n_shot_learning > 0) :
17
  for i in range(0, n_shot_learning):
18
  gen_text = gen_text[start_index:]
@@ -122,7 +125,7 @@ Give a score for the product. Format your response as a JSON object with \
122
  #return json.dumps(extract_json(gen_text, 3))
123
  gen_text = response["choices"][0]["text"]
124
  #return gen_text
125
- return extract_json(gen_text, 0)
126
  #return json.dumps(response)
127
 
128
  #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
12
  model_uri = "http://15.152.197.215/v1/completions"
13
 
14
  def extract_json(gen_text, n_shot_learning=0):
15
+ if(n_shot_learning == -1) :
16
+ start_index = 0
17
+ else :
18
+ start_index = gen_text.index("### Response:\n{") + 14
19
  if(n_shot_learning > 0) :
20
  for i in range(0, n_shot_learning):
21
  gen_text = gen_text[start_index:]
 
125
  #return json.dumps(extract_json(gen_text, 3))
126
  gen_text = response["choices"][0]["text"]
127
  #return gen_text
128
+ return extract_json(gen_text, -1)
129
  #return json.dumps(response)
130
 
131
  #iface = gr.Interface(fn=greet, inputs="text", outputs="text")