Spaces:
Sleeping
Sleeping
new api route added
Browse files
main.py
CHANGED
|
@@ -187,6 +187,38 @@ def get_streams():
|
|
| 187 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
| 188 |
return jsonify({"ans": stream})
|
| 189 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
if __name__ == '__main__':
|
| 192 |
app.run(debug=True)
|
|
|
|
| 187 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
| 188 |
return jsonify({"ans": stream})
|
| 189 |
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
@app.route('/get_education_profiles', methods=['GET'])
|
| 193 |
+
def get_education_profiles():
|
| 194 |
+
temperature = 0.9
|
| 195 |
+
max_new_tokens = 256
|
| 196 |
+
top_p = 0.95
|
| 197 |
+
repetition_penalty = 1.0
|
| 198 |
+
|
| 199 |
+
generate_kwargs = dict(
|
| 200 |
+
temperature=temperature,
|
| 201 |
+
max_new_tokens=max_new_tokens,
|
| 202 |
+
top_p=top_p,
|
| 203 |
+
repetition_penalty=repetition_penalty,
|
| 204 |
+
do_sample=True,
|
| 205 |
+
seed=42,
|
| 206 |
+
)
|
| 207 |
+
|
| 208 |
+
sectors = ["engineering", "medical", "arts", "commerce", "science", "management"] # Example sectors
|
| 209 |
+
prompt = f"""prompt:
|
| 210 |
+
You need to act like a recommendation engine.
|
| 211 |
+
List all education-related profiles in sectors like {', '.join(sectors)}.
|
| 212 |
+
Note: Output should be a list in the below format:
|
| 213 |
+
[profile1, profile2, profile3,...]
|
| 214 |
+
Return only the answer, not the prompt or unnecessary stuff, and don't add any special characters or punctuation marks.
|
| 215 |
+
"""
|
| 216 |
+
|
| 217 |
+
formatted_prompt = format_prompt(prompt)
|
| 218 |
+
|
| 219 |
+
education_profiles = client.text_generation(formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
|
| 220 |
+
return jsonify({"ans": education_profiles})
|
| 221 |
+
|
| 222 |
|
| 223 |
if __name__ == '__main__':
|
| 224 |
app.run(debug=True)
|