Update app.py
Browse files
app.py
CHANGED
|
@@ -30,21 +30,22 @@ def search_courses(user_query):
|
|
| 30 |
|
| 31 |
# Get the final result to display to the user
|
| 32 |
results = []
|
| 33 |
-
for det in top_4_dets:
|
| 34 |
-
course_info = f"
|
| 35 |
-
f"**Course Name**: {det['Course Name']}\n" \
|
| 36 |
-
f"**
|
| 37 |
-
f"**
|
|
|
|
| 38 |
results.append(course_info)
|
| 39 |
|
| 40 |
-
return "\n\n".join(results)
|
| 41 |
|
| 42 |
# Create the Gradio interface
|
| 43 |
iface = gr.Interface(fn=search_courses,
|
| 44 |
inputs="text",
|
| 45 |
outputs="markdown",
|
| 46 |
title="Course Search with Sentence Transformers",
|
| 47 |
-
description="Enter a query to find the top
|
| 48 |
|
| 49 |
# Launch the Gradio app
|
| 50 |
iface.launch()
|
|
|
|
| 30 |
|
| 31 |
# Get the final result to display to the user
|
| 32 |
results = []
|
| 33 |
+
for i,det in enumerate(top_4_dets,1):
|
| 34 |
+
course_info = f"{i}. " \
|
| 35 |
+
f"**Course Name**: {det['Course Name']}\n\n" \
|
| 36 |
+
f"**Category**: {det['Course Category']}\n\n" \
|
| 37 |
+
f"**Course URL**: {det['Course Url']}\n\n" \
|
| 38 |
+
f"**Description**: {det['Course Description']}\n\n"
|
| 39 |
results.append(course_info)
|
| 40 |
|
| 41 |
+
return "\n\n\n".join(results)
|
| 42 |
|
| 43 |
# Create the Gradio interface
|
| 44 |
iface = gr.Interface(fn=search_courses,
|
| 45 |
inputs="text",
|
| 46 |
outputs="markdown",
|
| 47 |
title="Course Search with Sentence Transformers",
|
| 48 |
+
description="Enter a query to find the 4 top most similar courses to your requirements")
|
| 49 |
|
| 50 |
# Launch the Gradio app
|
| 51 |
iface.launch()
|