zhiminy commited on
Commit
6414ec4
β€’
1 Parent(s): dccf2b3

create the search program

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -35
  2. app.py +69 -0
  3. requirements.txt +2 -0
.gitattributes CHANGED
@@ -1,35 +1 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ .venv
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import streamlit as st
3
+
4
+
5
+ def fetch_readme_content():
6
+ url = "https://raw.githubusercontent.com/SAILResearch/awesome-foundation-model-leaderboards/main/README.md"
7
+ response = requests.get(url)
8
+ if response.status_code == 200:
9
+ return response.text
10
+ else:
11
+ st.error("Failed to fetch README.md content from GitHub.")
12
+ return ""
13
+
14
+
15
+ class SearchApplication:
16
+ def __init__(self):
17
+ self.title = "Awesome Foundation Model Leaderboard Search"
18
+ self.set_page_config()
19
+
20
+ st.header(self.title)
21
+ col1, col2 = st.columns(2)
22
+ with col1:
23
+ self.query = st.text_input("Search English words", value="")
24
+
25
+ with col2:
26
+ st.write("#")
27
+ self.search_button = st.button("πŸ”Ž")
28
+
29
+ st.caption(
30
+ "You can search for open-source software from [200+ "
31
+ "repositories](https://github.com/SAILResearch/awesome-foundation-model-leaderboards)."
32
+ )
33
+ st.write("#")
34
+
35
+ self.show_search_results()
36
+
37
+ def set_page_config(self):
38
+ st.set_page_config(
39
+ page_title=self.title,
40
+ page_icon="😎",
41
+ layout="centered",
42
+ )
43
+
44
+
45
+ def show_search_results(self):
46
+ if self.query or self.search_button:
47
+ st.write("#")
48
+
49
+ readme_content = fetch_readme_content()
50
+
51
+ if readme_content:
52
+ search_results = []
53
+ lines = readme_content.split("\n")
54
+ for line in lines:
55
+ if self.query.lower() in line.lower():
56
+ search_results.append(line)
57
+
58
+ num_search_results = len(search_results)
59
+ st.write(f"A total of {num_search_results} matches found.")
60
+
61
+ if num_search_results > 0:
62
+ for result in search_results:
63
+ st.write(result)
64
+ else:
65
+ st.write("No matches found.")
66
+
67
+
68
+ if __name__ == "__main__":
69
+ SearchApplication()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ requests
2
+ streamlit