Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -247,6 +247,39 @@ def get_certificate():
|
|
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)
|
|
|
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 |
+
|
252 |
+
@app.route('/get_competition', methods=['POST'])
|
253 |
+
def get_competition():
|
254 |
+
temperature = 0.9
|
255 |
+
max_new_tokens = 256
|
256 |
+
top_p = 0.95
|
257 |
+
repetition_penalty = 1.0
|
258 |
+
|
259 |
+
content = request.json
|
260 |
+
# user_degree = content.get('degree') # Uncomment this line
|
261 |
+
user_stream = content.get('stream')
|
262 |
+
|
263 |
+
generate_kwargs = dict(
|
264 |
+
temperature=temperature,
|
265 |
+
max_new_tokens=max_new_tokens,
|
266 |
+
top_p=top_p,
|
267 |
+
repetition_penalty=repetition_penalty,
|
268 |
+
do_sample=True,
|
269 |
+
seed=42,
|
270 |
+
)
|
271 |
+
prompt = f""" prompt:
|
272 |
+
You need to act like as recommendation engine for competition recommendation for a student. Below are current details.
|
273 |
+
Stream: {user_stream}
|
274 |
+
Based on current details recommend the competition
|
275 |
+
Note: Output should be list in below format:
|
276 |
+
[course1, course2, course3,...]
|
277 |
+
Return only answer not prompt and unnecessary stuff, also dont add any special characters or punctuation marks
|
278 |
+
"""
|
279 |
+
formatted_prompt = format_prompt(prompt)
|
280 |
+
|
281 |
+
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
282 |
+
return jsonify({"ans": stream})
|
283 |
|
284 |
if __name__ == '__main__':
|
285 |
app.run(debug=True)
|