|
import pandas as pd |
|
import gradio as gr |
|
from Search_Engine.SmartSearchEngine import search_courses |
|
|
|
df = pd.read_pickle('output/courses_with_embeddings.pkl') |
|
|
|
|
|
def gradio_search(query): |
|
results = search_courses(query, top_n=5) |
|
return results.to_dict(orient='records') |
|
|
|
|
|
iface = gr.Interface( |
|
fn=gradio_search, |
|
inputs=gr.Textbox(lines=2, placeholder="Enter your search query here..."), |
|
outputs=gr.JSON(label="Search Results"), |
|
title="Smart Course Search Tool", |
|
description="Search for the most relevant courses on Analytics Vidhya" |
|
) |
|
|
|
|
|
iface.launch(share=True) |