subramaniansrc commited on
Commit
00d210a
·
verified ·
1 Parent(s): a28936b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -24
app.py CHANGED
@@ -6,7 +6,7 @@ import os
6
  from sklearn.ensemble import RandomForestRegressor
7
 
8
  # --------------------------------------------------
9
- # LOGO PATH (ABSOLUTE WINDOWS PATH)
10
  # --------------------------------------------------
11
  LOGO_FILE = r"C:\Users\SASTRA\Desktop\sastra_logo.jpg"
12
 
@@ -41,7 +41,7 @@ model = RandomForestRegressor(n_estimators=150, random_state=42)
41
  model.fit(X_train,y_train)
42
 
43
  # --------------------------------------------------
44
- # IQ CALCULATION (OUTPUT)
45
  # --------------------------------------------------
46
  def calculate_iq(reasoning, aptitude, problem_solving,
47
  verbal, communication, understanding):
@@ -58,7 +58,7 @@ def calculate_iq(reasoning, aptitude, problem_solving,
58
  return round(iq,2)
59
 
60
  # --------------------------------------------------
61
- # ANTIGRAVITY AI FUNCTION
62
  # --------------------------------------------------
63
  def institutional_ai(
64
  name, regno, vision, mission, arrears,
@@ -82,7 +82,7 @@ def institutional_ai(
82
 
83
  performance = float(model.predict(features)[0])
84
 
85
- # -------- Weak Areas --------
86
  weak=[]
87
  if coding<5: weak.append("Coding")
88
  if aptitude<5: weak.append("Aptitude")
@@ -91,7 +91,7 @@ def institutional_ai(
91
 
92
  concentration=", ".join(weak) if weak else "Balanced Skill Profile"
93
 
94
- # -------- Placement --------
95
  if performance>=80 and cgpa>=8:
96
  placement="High Probability → Product Companies"
97
  elif performance>=65:
@@ -141,9 +141,6 @@ Student: {name} ({regno})
141
  Predicted Performance : {round(performance,2)}
142
  Estimated IQ : {iq}
143
 
144
- Academic Trend:
145
- {"Improving" if sg6>=sg1 else "Needs Improvement"}
146
-
147
  Focus Areas:
148
  {concentration}
149
 
@@ -151,21 +148,15 @@ Placement Outlook:
151
  {placement}
152
  """
153
 
154
- # --------------------------------------------------
155
- # SAVE CSV
156
- # --------------------------------------------------
157
- row={
158
- "Name":name,"RegisterNo":regno,
159
- "Arrears":arrears,
160
- "SGPA1":sg1,"SGPA2":sg2,"SGPA3":sg3,
161
- "SGPA4":sg4,"SGPA5":sg5,"SGPA6":sg6,
162
  "CGPA":cgpa,
163
  "IQ":iq,
164
  "Performance":round(performance,2),
165
  "Placement":placement
166
- }
167
-
168
- df=pd.DataFrame([row])
169
 
170
  if os.path.exists(CSV_FILE):
171
  df.to_csv(CSV_FILE,mode='a',header=False,index=False)
@@ -180,12 +171,10 @@ Placement Outlook:
180
  # --------------------------------------------------
181
  with gr.Blocks() as demo:
182
 
183
- # Safe logo display
184
  if os.path.exists(LOGO_FILE):
185
- gr.Image(value=LOGO_FILE,
186
- show_label=False,
187
- container=False,
188
- height=150)
189
 
190
  gr.HTML(INSTITUTION_HTML)
191
 
 
6
  from sklearn.ensemble import RandomForestRegressor
7
 
8
  # --------------------------------------------------
9
+ # CORRECT LOGO PATH (RAW STRING)
10
  # --------------------------------------------------
11
  LOGO_FILE = r"C:\Users\SASTRA\Desktop\sastra_logo.jpg"
12
 
 
41
  model.fit(X_train,y_train)
42
 
43
  # --------------------------------------------------
44
+ # IQ CALCULATION
45
  # --------------------------------------------------
46
  def calculate_iq(reasoning, aptitude, problem_solving,
47
  verbal, communication, understanding):
 
58
  return round(iq,2)
59
 
60
  # --------------------------------------------------
61
+ # MAIN AI FUNCTION
62
  # --------------------------------------------------
63
  def institutional_ai(
64
  name, regno, vision, mission, arrears,
 
82
 
83
  performance = float(model.predict(features)[0])
84
 
85
+ # Weak areas
86
  weak=[]
87
  if coding<5: weak.append("Coding")
88
  if aptitude<5: weak.append("Aptitude")
 
91
 
92
  concentration=", ".join(weak) if weak else "Balanced Skill Profile"
93
 
94
+ # Placement prediction
95
  if performance>=80 and cgpa>=8:
96
  placement="High Probability → Product Companies"
97
  elif performance>=65:
 
141
  Predicted Performance : {round(performance,2)}
142
  Estimated IQ : {iq}
143
 
 
 
 
144
  Focus Areas:
145
  {concentration}
146
 
 
148
  {placement}
149
  """
150
 
151
+ # Save CSV
152
+ df=pd.DataFrame([{
153
+ "Name":name,
154
+ "RegisterNo":regno,
 
 
 
 
155
  "CGPA":cgpa,
156
  "IQ":iq,
157
  "Performance":round(performance,2),
158
  "Placement":placement
159
+ }])
 
 
160
 
161
  if os.path.exists(CSV_FILE):
162
  df.to_csv(CSV_FILE,mode='a',header=False,index=False)
 
171
  # --------------------------------------------------
172
  with gr.Blocks() as demo:
173
 
174
+ # Logo display (safe)
175
  if os.path.exists(LOGO_FILE):
176
+ gr.Image(LOGO_FILE, show_label=False,
177
+ container=False, height=150)
 
 
178
 
179
  gr.HTML(INSTITUTION_HTML)
180