Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,24 @@ import re
|
|
| 4 |
from urllib.parse import urljoin
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
-
def
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|