debisoft commited on
Commit
9d7dd27
·
1 Parent(s): 7c6471e
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -56,7 +56,7 @@ I am building an online community to help people to find dates.
56
  {{"solution": "FindDates.com", "problem": "finding a date", "features": "online community to help people find dates", "target_customer": "people looking for a date", "fg_will_use": "True", "reason_to_use": "I am looking for an online community to help people find dates. FindDates.com meets my needs and I would use it to find my next great date.","fg_will_pay": "True", "reason_to_pay": "I would not pay for it as I am looking for an online community to help people find dates. But for products related to dating, paying for it would be a no-brainer.","fg_will_invest": "False", "reason_to_invest": "There are many online dating platforms already.","score": "40"}}
57
  """
58
 
59
- def extract_json(gen_text, response, n_shot_learning=0):
60
  if(n_shot_learning == -1) :
61
  start_index = 0
62
  else :
@@ -99,6 +99,7 @@ def score_model(model_uri, databricks_token, prompt):
99
  print(response.status_code)
100
  print(response.txt)
101
  print("End***No choices!!!")
 
102
  return response_json
103
 
104
  def get_completion(prompt):
@@ -133,7 +134,7 @@ Give a score for the product. Format your response as a JSON object with \
133
  print(total_prompt)
134
  response = get_completion(total_prompt)
135
  gen_text = response["choices"][0]["text"]
136
- return json.dumps(extract_json(gen_text, response, -1))
137
 
138
  #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
139
  #iface.launch()
 
56
  {{"solution": "FindDates.com", "problem": "finding a date", "features": "online community to help people find dates", "target_customer": "people looking for a date", "fg_will_use": "True", "reason_to_use": "I am looking for an online community to help people find dates. FindDates.com meets my needs and I would use it to find my next great date.","fg_will_pay": "True", "reason_to_pay": "I would not pay for it as I am looking for an online community to help people find dates. But for products related to dating, paying for it would be a no-brainer.","fg_will_invest": "False", "reason_to_invest": "There are many online dating platforms already.","score": "40"}}
57
  """
58
 
59
+ def extract_json(gen_text, n_shot_learning=0):
60
  if(n_shot_learning == -1) :
61
  start_index = 0
62
  else :
 
99
  print(response.status_code)
100
  print(response.txt)
101
  print("End***No choices!!!")
102
+
103
  return response_json
104
 
105
  def get_completion(prompt):
 
134
  print(total_prompt)
135
  response = get_completion(total_prompt)
136
  gen_text = response["choices"][0]["text"]
137
+ return json.dumps(extract_json(gen_text, -1))
138
 
139
  #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
140
  #iface.launch()