Spaces:
Sleeping
Sleeping
Rohil Bansal
commited on
Commit
·
9bfbaa6
1
Parent(s):
af2c973
final
Browse files
.gitignore
CHANGED
@@ -1,3 +1,2 @@
|
|
1 |
.env
|
2 |
-
|
3 |
-
|
|
|
1 |
.env
|
2 |
+
__pycache__
|
|
course_search/app/gradio_app.py
CHANGED
@@ -53,7 +53,7 @@ class CourseSearchApp:
|
|
53 |
logger.error(f"Error loading components: {str(e)}")
|
54 |
raise
|
55 |
|
56 |
-
def search_courses(self, query: str, num_results: int) -> str:
|
57 |
"""
|
58 |
Search for courses and format results for Gradio
|
59 |
"""
|
@@ -63,9 +63,18 @@ class CourseSearchApp:
|
|
63 |
# Format results for display
|
64 |
markdown_output = "# Search Results\n\n"
|
65 |
for i, result in enumerate(results['results'], 1):
|
66 |
-
markdown_output += f"### {i}. {result['title']}\n"
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
markdown_output += "---\n\n"
|
70 |
|
71 |
return markdown_output
|
@@ -95,13 +104,18 @@ def create_gradio_interface():
|
|
95 |
value=5,
|
96 |
step=1,
|
97 |
label="Number of Results"
|
|
|
|
|
|
|
|
|
|
|
98 |
)
|
99 |
],
|
100 |
outputs=gr.Markdown(),
|
101 |
title="Analytics Vidhya Course Search",
|
102 |
description="""
|
103 |
Search through Analytics Vidhya's free courses using natural language!
|
104 |
-
Get personalized course recommendations
|
105 |
""",
|
106 |
theme=gr.themes.Soft()
|
107 |
)
|
|
|
53 |
logger.error(f"Error loading components: {str(e)}")
|
54 |
raise
|
55 |
|
56 |
+
def search_courses(self, query: str, num_results: int, show_curriculum: bool) -> str:
|
57 |
"""
|
58 |
Search for courses and format results for Gradio
|
59 |
"""
|
|
|
63 |
# Format results for display
|
64 |
markdown_output = "# Search Results\n\n"
|
65 |
for i, result in enumerate(results['results'], 1):
|
66 |
+
markdown_output += f"### {i}. {result['title']}\n\n"
|
67 |
+
|
68 |
+
if result.get('description'):
|
69 |
+
markdown_output += f"**Description:**\n{result['description']}\n\n"
|
70 |
+
|
71 |
+
# Only show curriculum if checkbox is checked
|
72 |
+
if show_curriculum and result.get('curriculum'):
|
73 |
+
markdown_output += f"**Course Curriculum:**\n{result['curriculum']}\n\n"
|
74 |
+
|
75 |
+
if result.get('url'):
|
76 |
+
markdown_output += f"**Course Link:** [View Course]({result['url']})\n\n"
|
77 |
+
|
78 |
markdown_output += "---\n\n"
|
79 |
|
80 |
return markdown_output
|
|
|
104 |
value=5,
|
105 |
step=1,
|
106 |
label="Number of Results"
|
107 |
+
),
|
108 |
+
gr.Checkbox(
|
109 |
+
label="Show Course Curriculum",
|
110 |
+
value=False,
|
111 |
+
info="Check this to view detailed curriculum for each course"
|
112 |
)
|
113 |
],
|
114 |
outputs=gr.Markdown(),
|
115 |
title="Analytics Vidhya Course Search",
|
116 |
description="""
|
117 |
Search through Analytics Vidhya's free courses using natural language!
|
118 |
+
Get personalized course recommendations based on your interests.
|
119 |
""",
|
120 |
theme=gr.themes.Soft()
|
121 |
)
|
data/cache/course_embeddings.npy
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:8f4d91de39bffed6c0291356791966feaaf2314c2d3391975038eec443e570f8
|
3 |
-
size 40064
|
|
|
|
|
|
|
|
data/cache/faiss_index.bin
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:406a21e75f0af486e6bef5f8270daf482f2b7a7c1cf45d1091aabc25455a4ba7
|
3 |
-
size 39981
|
|
|
|
|
|
|
|
data/courses.pkl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:f2945792f4e7f95855e4f48bcf3977aa52ec3156242e70efcaaf07f44864267a
|
3 |
-
size 77762
|
|
|
|
|
|
|
|
data/courses_with_embeddings.pkl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:ee32928e02155e79620c72b032cd166fefc8de20dd648b65cea7aa3a6b2641bf
|
3 |
-
size 118516
|
|
|
|
|
|
|
|
data/embedding_cache/embeddings_cache_all-MiniLM-L6-v2.pkl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:c05df73cb5ed569e2c252f4b6fed91aec245f8634b7023cfd134dfd58bb3024a
|
3 |
-
size 166317
|
|
|
|
|
|
|
|