debisoft commited on
Commit
8b2e718
·
1 Parent(s): 5f67259
Files changed (1) hide show
  1. app.py +3 -3
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, n_shot_learning=0):
60
  if(n_shot_learning == -1) :
61
  start_index = 0
62
  else :
@@ -69,7 +69,7 @@ def extract_json(gen_text, n_shot_learning=0):
69
  end_index = gen_text.find("}\n\n### ")
70
  if(end_index == -1) :
71
  print("Start***No end index!!!")
72
- print(gen_text)
73
  print("End***No end index!!!")
74
 
75
  end_index = end_index + 1
@@ -129,7 +129,7 @@ Give a score for the product. Format your response as a JSON object with \
129
  print(total_prompt)
130
  response = get_completion(total_prompt)
131
  gen_text = response["choices"][0]["text"]
132
- return json.dumps(extract_json(gen_text, -1))
133
 
134
  #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
135
  #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, response):
60
  if(n_shot_learning == -1) :
61
  start_index = 0
62
  else :
 
69
  end_index = gen_text.find("}\n\n### ")
70
  if(end_index == -1) :
71
  print("Start***No end index!!!")
72
+ print(response)
73
  print("End***No end index!!!")
74
 
75
  end_index = end_index + 1
 
129
  print(total_prompt)
130
  response = get_completion(total_prompt)
131
  gen_text = response["choices"][0]["text"]
132
+ return json.dumps(extract_json(gen_text, -1, response))
133
 
134
  #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
135
  #iface.launch()