its-abhay777
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
import pandas as pd
|
2 |
-
import gradio as gr
|
3 |
-
from SmartSearchEngine import search_courses
|
4 |
-
|
5 |
-
# Load the DataFrame with embeddings
|
6 |
-
df = pd.read_pickle('output/courses_with_embeddings.pkl')
|
7 |
-
|
8 |
-
# Define the search function to be used in the Gradio interface
|
9 |
-
def gradio_search(query):
|
10 |
-
results = search_courses(query, top_n=5)
|
11 |
-
return results.to_dict(orient='records')
|
12 |
-
|
13 |
-
# Create a Gradio interface
|
14 |
-
iface = gr.Interface(
|
15 |
-
fn=gradio_search,
|
16 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter your search query here..."),
|
17 |
-
outputs=gr.JSON(label="Search Results"),
|
18 |
-
title="Smart Course Search Tool",
|
19 |
-
description="Search for the most relevant courses on Analytics Vidhya"
|
20 |
-
)
|
21 |
-
|
22 |
-
# Launch the Gradio interface
|
23 |
iface.launch(share=True)
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import gradio as gr
|
3 |
+
from ./Search Engine/SmartSearchEngine import search_courses
|
4 |
+
|
5 |
+
# Load the DataFrame with embeddings
|
6 |
+
df = pd.read_pickle('output/courses_with_embeddings.pkl')
|
7 |
+
|
8 |
+
# Define the search function to be used in the Gradio interface
|
9 |
+
def gradio_search(query):
|
10 |
+
results = search_courses(query, top_n=5)
|
11 |
+
return results.to_dict(orient='records')
|
12 |
+
|
13 |
+
# Create a Gradio interface
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=gradio_search,
|
16 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter your search query here..."),
|
17 |
+
outputs=gr.JSON(label="Search Results"),
|
18 |
+
title="Smart Course Search Tool",
|
19 |
+
description="Search for the most relevant courses on Analytics Vidhya"
|
20 |
+
)
|
21 |
+
|
22 |
+
# Launch the Gradio interface
|
23 |
iface.launch(share=True)
|