TuneedTG commited on
Commit
aa96112
·
verified ·
1 Parent(s): 81a7245

Upload 2 files

Browse files
Files changed (2) hide show
  1. courses.csv +51 -0
  2. da.py +60 -0
courses.csv ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ title,description,keywords
2
+ Machine Learning Basics,"Understand the fundamentals of statistics, including probability distributions and hypothesis testing.","Data Engineering, ETL"
3
+ Computer Vision with Python,Explore computer vision techniques and applications using Python libraries.,"Machine Learning, AI"
4
+ Natural Language Processing Essentials,"This course covers the basics of data science, including data analysis and visualization.","Python, Data Analysis"
5
+ Introduction to Data Science,Get started with natural language processing using Python and popular NLP libraries.,"AI, Beginners"
6
+ Data Engineering Concepts,"Explore advanced topics in deep learning, including neural networks and backpropagation.","Machine Learning, AI"
7
+ Machine Learning Basics,"This course covers the basics of data science, including data analysis and visualization.","Computer Vision, Python"
8
+ Computer Vision with Python,"Explore advanced topics in deep learning, including neural networks and backpropagation.","Computer Vision, Python"
9
+ Introduction to Data Science,"Understand the fundamentals of statistics, including probability distributions and hypothesis testing.","Machine Learning, AI"
10
+ Computer Vision with Python,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Data Engineering, ETL"
11
+ Machine Learning Basics,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Computer Vision, Python"
12
+ Python for Data Analysis,An introduction to artificial intelligence concepts and applications for beginners.,"Machine Learning, AI"
13
+ Advanced Deep Learning,"Learn data engineering concepts such as ETL, data pipelines, and big data.","AI, Beginners"
14
+ Computer Vision with Python,A beginner-friendly course on data analysis using Python libraries like Pandas and Numpy.,"Python, Data Analysis"
15
+ Introduction to Data Science,"Learn data engineering concepts such as ETL, data pipelines, and big data.","Data Engineering, ETL"
16
+ Data Engineering Concepts,A beginner-friendly course on data analysis using Python libraries like Pandas and Numpy.,"Deep Learning, Neural Networks"
17
+ Data Visualization with Python,"Explore advanced topics in deep learning, including neural networks and backpropagation.","Visualization, Matplotlib"
18
+ Machine Learning Basics,Explore computer vision techniques and applications using Python libraries.,"Visualization, Matplotlib"
19
+ Machine Learning Basics,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Computer Vision, Python"
20
+ Statistics Fundamentals,Learn the foundational concepts of machine learning and how to apply them.,"AI, Beginners"
21
+ Data Visualization with Python,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Data Engineering, ETL"
22
+ Introduction to Data Science,Explore computer vision techniques and applications using Python libraries.,"Data Science, Python, Visualization"
23
+ Statistics Fundamentals,Explore computer vision techniques and applications using Python libraries.,"Machine Learning, AI"
24
+ Computer Vision with Python,"This course covers the basics of data science, including data analysis and visualization.","Deep Learning, Neural Networks"
25
+ Python for Data Analysis,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Data Science, Python, Visualization"
26
+ Advanced Deep Learning,Learn the foundational concepts of machine learning and how to apply them.,"AI, Beginners"
27
+ Introduction to Data Science,Explore computer vision techniques and applications using Python libraries.,"Data Engineering, ETL"
28
+ Data Engineering Concepts,Get started with natural language processing using Python and popular NLP libraries.,"NLP, Language Processing"
29
+ Statistics Fundamentals,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Deep Learning, Neural Networks"
30
+ Python for Data Analysis,"Learn data engineering concepts such as ETL, data pipelines, and big data.","Data Engineering, ETL"
31
+ Computer Vision with Python,Explore computer vision techniques and applications using Python libraries.,"Python, Data Analysis"
32
+ Data Engineering Concepts,"Understand the fundamentals of statistics, including probability distributions and hypothesis testing.","Data Science, Python, Visualization"
33
+ AI for Beginners,Get started with natural language processing using Python and popular NLP libraries.,"Statistics, Probability"
34
+ Python for Data Analysis,"Learn data engineering concepts such as ETL, data pipelines, and big data.","NLP, Language Processing"
35
+ Python for Data Analysis,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Data Engineering, ETL"
36
+ Computer Vision with Python,Learn the foundational concepts of machine learning and how to apply them.,"Machine Learning, AI"
37
+ Natural Language Processing Essentials,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"Data Engineering, ETL"
38
+ Computer Vision with Python,A beginner-friendly course on data analysis using Python libraries like Pandas and Numpy.,"Statistics, Probability"
39
+ Advanced Deep Learning,"Understand the fundamentals of statistics, including probability distributions and hypothesis testing.","Deep Learning, Neural Networks"
40
+ Python for Data Analysis,An introduction to artificial intelligence concepts and applications for beginners.,"Computer Vision, Python"
41
+ Data Engineering Concepts,An introduction to artificial intelligence concepts and applications for beginners.,"AI, Beginners"
42
+ Machine Learning Basics,A beginner-friendly course on data analysis using Python libraries like Pandas and Numpy.,"Deep Learning, Neural Networks"
43
+ Advanced Deep Learning,Explore computer vision techniques and applications using Python libraries.,"Deep Learning, Neural Networks"
44
+ Statistics Fundamentals,"This course covers the basics of data science, including data analysis and visualization.","Statistics, Probability"
45
+ Statistics Fundamentals,A beginner-friendly course on data analysis using Python libraries like Pandas and Numpy.,"Machine Learning, AI"
46
+ Python for Data Analysis,An introduction to artificial intelligence concepts and applications for beginners.,"Data Science, Python, Visualization"
47
+ Advanced Deep Learning,"Understand the fundamentals of statistics, including probability distributions and hypothesis testing.","Python, Data Analysis"
48
+ AI for Beginners,Learn the foundational concepts of machine learning and how to apply them.,"Data Engineering, ETL"
49
+ Data Visualization with Python,"Explore advanced topics in deep learning, including neural networks and backpropagation.","Visualization, Matplotlib"
50
+ Python for Data Analysis,An introduction to artificial intelligence concepts and applications for beginners.,"NLP, Language Processing"
51
+ Machine Learning Basics,Learn how to create stunning visualizations with libraries such as Matplotlib and Seaborn.,"NLP, Language Processing"
da.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """Da.ipynb
3
+
4
+ Automatically generated by Colab.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1Kg9-C_Fif3yO8FuXT84Tci-3ItuLsS7p
8
+ """
9
+
10
+ #Library install
11
+ !pip install transformers sentence-transformers gradio
12
+
13
+ import pandas as pd
14
+ from sentence_transformers import SentenceTransformer
15
+ from sklearn.metrics.pairwise import cosine_similarity
16
+ import gradio as gr
17
+
18
+ # Load the dataset
19
+ df = pd.read_csv('/content/courses.csv') # Replace with actual path to courses.csv
20
+
21
+ # Load a pre-trained sentence transformer model
22
+ model = SentenceTransformer('all-MiniLM-L6-v2')
23
+
24
+ # Create a combined column for embedding (e.g., title + description + keywords)
25
+ df['combined_text'] = df['title'] + " " + df['description'] + " " + df['keywords']
26
+ course_embeddings = model.encode(df['combined_text'].tolist(), convert_to_tensor=True)
27
+
28
+ def search_courses(user_query):
29
+ # Encode the user query
30
+ query_embedding = model.encode(user_query, convert_to_tensor=True)
31
+
32
+ # Compute cosine similarities between the query and each course embedding
33
+ similarities = cosine_similarity(
34
+ query_embedding.cpu().detach().numpy().reshape(1, -1),
35
+ course_embeddings.cpu().detach().numpy()
36
+ )
37
+
38
+ # Get indices of top matching courses (top 5 results)
39
+ top_matches = similarities.argsort()[0][-5:][::-1]
40
+
41
+ # Retrieve top matching courses
42
+ results = [{"title": df.iloc[i]["title"], "description": df.iloc[i]["description"]} for i in top_matches]
43
+ return results
44
+
45
+ # Define Gradio function for user interaction
46
+ def gradio_search(query):
47
+ results = search_courses(query)
48
+ return results
49
+
50
+ # Set up Gradio interface
51
+ iface = gr.Interface(
52
+ fn=gradio_search,
53
+ inputs="text",
54
+ outputs="json",
55
+ title="Smart Course Search",
56
+ description="Find the most relevant courses based on your query."
57
+ )
58
+
59
+ # Launch the app (for local testing or deploying in Hugging Face Spaces)
60
+ iface.launch()