Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -215,6 +215,38 @@ def get_education_profiles():
|
|
215 |
education_profiles = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
216 |
return jsonify({"ans": education_profiles})
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
if __name__ == '__main__':
|
220 |
app.run(debug=True)
|
|
|
215 |
education_profiles = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
216 |
return jsonify({"ans": education_profiles})
|
217 |
|
218 |
+
|
219 |
+
@app.route('/get_certificate', methods=['POST'])
|
220 |
+
def get_certificate():
|
221 |
+
temperature = 0.9
|
222 |
+
max_new_tokens = 256
|
223 |
+
top_p = 0.95
|
224 |
+
repetition_penalty = 1.0
|
225 |
+
|
226 |
+
content = request.json
|
227 |
+
# user_degree = content.get('degree') # Uncomment this line
|
228 |
+
user_stream = content.get('stream')
|
229 |
+
|
230 |
+
generate_kwargs = dict(
|
231 |
+
temperature=temperature,
|
232 |
+
max_new_tokens=max_new_tokens,
|
233 |
+
top_p=top_p,
|
234 |
+
repetition_penalty=repetition_penalty,
|
235 |
+
do_sample=True,
|
236 |
+
seed=42,
|
237 |
+
)
|
238 |
+
prompt = f""" prompt:
|
239 |
+
You need to act like as recommendation engine for certification recommendation for a student. Below are current details.
|
240 |
+
Stream: {user_stream}
|
241 |
+
Based on current details recommend the certification
|
242 |
+
Note: Output should be list in below format:
|
243 |
+
[course1, course2, course3,...]
|
244 |
+
Return only answer not prompt and unnecessary stuff, also dont add any special characters or punctuation marks
|
245 |
+
"""
|
246 |
+
formatted_prompt = format_prompt(prompt)
|
247 |
+
|
248 |
+
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
249 |
+
return jsonify({"ans": stream})
|
250 |
|
251 |
if __name__ == '__main__':
|
252 |
app.run(debug=True)
|