Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -4,9 +4,16 @@ import random
|
|
4 |
|
5 |
from flask import Flask, request, jsonify, redirect, url_for
|
6 |
from flask_cors import CORS
|
|
|
|
|
7 |
|
8 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.1")
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
app = Flask(__name__)
|
11 |
CORS(app)
|
12 |
|
@@ -109,7 +116,19 @@ def get_mentor():
|
|
109 |
user_stream = content.get('stream')
|
110 |
#user_semester = content.get('semester')
|
111 |
courses = content.get('courses')
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
temperature = float(temperature)
|
115 |
if temperature < 1e-2:
|
@@ -134,7 +153,6 @@ def get_mentor():
|
|
134 |
Based on above details recommend the mentor that realtes to above details
|
135 |
Note: Output should be list in below format:
|
136 |
[mentor1,mentor2,mentor3,...]
|
137 |
-
Return only answer which is in [] brackets not prompt and unnecessary stuff, also dont add any special characters or punctuation marks
|
138 |
"""
|
139 |
formatted_prompt = format_prompt(prompt)
|
140 |
|
|
|
4 |
|
5 |
from flask import Flask, request, jsonify, redirect, url_for
|
6 |
from flask_cors import CORS
|
7 |
+
from sqlalchemy import create_engine
|
8 |
+
from sqlalchemy.orm import sessionmaker
|
9 |
|
10 |
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.1")
|
11 |
|
12 |
+
connection_string = "postgresql://data_owner:PFAnX9oJp4wV@ep-green-heart-a78sxj65.ap-southeast-2.aws.neon.tech/figurecircle?sslmode=require"
|
13 |
+
|
14 |
+
engine = create_engine(connection_string)
|
15 |
+
Session = sessionmaker(bind=engine)
|
16 |
+
|
17 |
app = Flask(__name__)
|
18 |
CORS(app)
|
19 |
|
|
|
116 |
user_stream = content.get('stream')
|
117 |
#user_semester = content.get('semester')
|
118 |
courses = content.get('courses')
|
119 |
+
|
120 |
+
session = Session()
|
121 |
+
|
122 |
+
# Query verified mentors
|
123 |
+
verified_mentors = session.query(Mentor).filter_by(verified=True).all()
|
124 |
+
|
125 |
+
mentor_list = [{"id": mentor.id, "mentor_name": mentor.mentor_name, "skills": mentor.skills,
|
126 |
+
"qualification": mentor.qualification, "experience": mentor.experience,
|
127 |
+
"verified": mentor.verified} for mentor in verified_mentors]
|
128 |
+
|
129 |
+
session.close()
|
130 |
+
|
131 |
+
mentors_data= mentor_list
|
132 |
|
133 |
temperature = float(temperature)
|
134 |
if temperature < 1e-2:
|
|
|
153 |
Based on above details recommend the mentor that realtes to above details
|
154 |
Note: Output should be list in below format:
|
155 |
[mentor1,mentor2,mentor3,...]
|
|
|
156 |
"""
|
157 |
formatted_prompt = format_prompt(prompt)
|
158 |
|