Swapnil-101 commited on
Commit
eedf29c
·
verified ·
1 Parent(s): a6b3f44

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +32 -0
main.py CHANGED
@@ -198,6 +198,38 @@ def get_streams():
198
  return jsonify({"ans": stream})
199
 
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  @app.route('/get_education_profiles', methods=['GET'])
203
  def get_education_profiles():
 
198
  return jsonify({"ans": stream})
199
 
200
 
201
+ @app.route('/get_streams_degree', methods=['POST'])
202
+ def get_streams():
203
+ data = request.get_json()
204
+ degree = data.get('degree')
205
+
206
+ temperature = 0.9
207
+ max_new_tokens = 256
208
+ top_p = 0.95
209
+ repetition_penalty = 1.0
210
+
211
+ generate_kwargs = dict(
212
+ temperature=temperature,
213
+ max_new_tokens=max_new_tokens,
214
+ top_p=top_p,
215
+ repetition_penalty=repetition_penalty,
216
+ do_sample=True,
217
+ seed=42,
218
+ )
219
+ prompt = f""" prompt:
220
+ You need to act like as recommendation engine.
221
+ List 5 streams/branches based on the degree provided.
222
+ For example, if the degree is 'bachelors', list 5 streams related to bachelor's degree.
223
+ Note: Output should be list in below format:
224
+ [branch1, branch2, branch3,...]
225
+ Return only answer not prompt and unnecessary stuff, also dont add any special characters or punctuation marks
226
+ """
227
+ formatted_prompt = format_prompt(prompt)
228
+
229
+ stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
230
+ return jsonify({"ans": stream})
231
+
232
+
233
 
234
  @app.route('/get_education_profiles', methods=['GET'])
235
  def get_education_profiles():