Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# File 1: app.py
|
2 |
+
import streamlit as st
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
# Sample course data
|
6 |
+
courses = [
|
7 |
+
{
|
8 |
+
"title": "Python for Data Science",
|
9 |
+
"description": "Learn Python programming fundamentals for data science applications",
|
10 |
+
"level": "Beginner"
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"title": "Machine Learning Basics",
|
14 |
+
"description": "Understanding machine learning concepts and algorithms",
|
15 |
+
"level": "Intermediate"
|
16 |
+
},
|
17 |
+
]
|
18 |
+
|
19 |
+
# Page config
|
20 |
+
st.set_page_config(
|
21 |
+
page_title="Course Search",
|
22 |
+
page_icon="π"
|
23 |
+
)
|
24 |
+
|
25 |
+
# Create the Streamlit app
|
26 |
+
st.title("π Course Search")
|
27 |
+
st.write("Search through available courses")
|
28 |
+
|
29 |
+
# Create a simple search box
|
30 |
+
search_query = st.text_input("Enter keywords to search:", "")
|
31 |
+
|
32 |
+
# Simple search function
|
33 |
+
if search_query:
|
34 |
+
found_courses = False
|
35 |
+
# Convert search query to lowercase for case-insensitive search
|
36 |
+
search_query = search_query.lower()
|
37 |
+
|
38 |
+
# Search through courses
|
39 |
+
for course in courses:
|
40 |
+
# Check if search query exists in title or description
|
41 |
+
if (search_query in course["title"].lower() or
|
42 |
+
search_query in course["description"].lower()):
|
43 |
+
|
44 |
+
# Display matching course in a box
|
45 |
+
st.success("Match found!")
|
46 |
+
with st.container():
|
47 |
+
st.markdown(f"### {course['title']}")
|
48 |
+
st.write(f"π Description: {course['description']}")
|
49 |
+
st.write(f"π Level: {course['level']}")
|
50 |
+
st.divider()
|
51 |
+
found_courses = True
|
52 |
+
|
53 |
+
if not found_courses:
|
54 |
+
st.warning("No courses found matching your search.")
|
55 |
+
|
56 |
+
# File 2: requirements.txt
|
57 |
+
#streamlit==1.24.0
|
58 |
+
#pandas==2.0.3
|