jayanth-2005 commited on
Commit
da64f61
·
verified ·
1 Parent(s): 5bef5e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -4,12 +4,24 @@ import re
4
  from urllib.parse import urljoin
5
  import gradio as gr
6
 
7
- def extract_name(text):
8
- # Simple heuristic for names
9
- words = text.strip().split()
10
- if 2 <= len(words) <= 5 and text.istitle():
11
- return text.strip()
12
- return None
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  def get_professor_details(college_url):
15
  try:
 
4
  from urllib.parse import urljoin
5
  import gradio as gr
6
 
7
+ def extract_name_from_block(text):
8
+ lines = text.split("\n")
9
+
10
+ for line in lines:
11
+ line = line.strip()
12
+
13
+ # Skip unwanted lines
14
+ if any(word in line.lower() for word in [
15
+ "school", "department", "email", "phone", "office"
16
+ ]):
17
+ continue
18
+
19
+ # Check if line looks like a name
20
+ words = line.split()
21
+ if 2 <= len(words) <= 5:
22
+ return line
23
+
24
+ return "Not found"
25
 
26
  def get_professor_details(college_url):
27
  try: