upload application files
Browse files- app.py +93 -0
- indexes/docs/_1.fdm +0 -0
- indexes/docs/_1.fdt +0 -0
- indexes/docs/_1.fdx +0 -0
- indexes/docs/_1.fnm +0 -0
- indexes/docs/_1.nvd +0 -0
- indexes/docs/_1.nvm +0 -0
- indexes/docs/_1.si +0 -0
- indexes/docs/_1.tvd +0 -0
- indexes/docs/_1.tvm +0 -0
- indexes/docs/_1.tvx +0 -0
- indexes/docs/_1_Lucene90_0.doc +0 -0
- indexes/docs/_1_Lucene90_0.dvd +0 -0
- indexes/docs/_1_Lucene90_0.dvm +0 -0
- indexes/docs/_1_Lucene90_0.pos +0 -0
- indexes/docs/_1_Lucene90_0.tim +0 -0
- indexes/docs/_1_Lucene90_0.tip +0 -0
- indexes/docs/_1_Lucene90_0.tmd +0 -0
- indexes/docs/segments_2 +0 -0
- indexes/docs/write.lock +0 -0
- packages.txt +1 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
from pyserini.search.lucene import LuceneSearcher
|
5 |
+
|
6 |
+
|
7 |
+
class SearchApplication:
|
8 |
+
def __init__(self):
|
9 |
+
self.title = "Awesome ChatGPT repositories search"
|
10 |
+
|
11 |
+
self.set_page_config()
|
12 |
+
self.searcher = self.set_searcher()
|
13 |
+
|
14 |
+
st.header(self.title)
|
15 |
+
col1, col2 = st.columns(2)
|
16 |
+
with col1:
|
17 |
+
self.query = st.text_input("Search words", value="")
|
18 |
+
|
19 |
+
with col2:
|
20 |
+
st.write("#")
|
21 |
+
self.search_button = st.button("π")
|
22 |
+
|
23 |
+
st.caption(
|
24 |
+
"You can search for open-source software from [500+ "
|
25 |
+
" repositories](https://github.com/taishi-i/awesome-ChatGPT-repositories)."
|
26 |
+
)
|
27 |
+
st.write("#")
|
28 |
+
|
29 |
+
self.show_popular_words()
|
30 |
+
self.show_search_results()
|
31 |
+
|
32 |
+
def set_page_config(self):
|
33 |
+
st.set_page_config(
|
34 |
+
page_title=self.title,
|
35 |
+
page_icon="π",
|
36 |
+
layout="centered",
|
37 |
+
)
|
38 |
+
|
39 |
+
def set_searcher(self):
|
40 |
+
searcher = LuceneSearcher("indexes/docs")
|
41 |
+
return searcher
|
42 |
+
|
43 |
+
def show_popular_words(self):
|
44 |
+
st.caption("Popular words")
|
45 |
+
|
46 |
+
word1, word2, word3, word4, _ = st.columns(5)
|
47 |
+
with word1:
|
48 |
+
button1 = st.button("Prompt")
|
49 |
+
if button1:
|
50 |
+
self.query = "prompt"
|
51 |
+
|
52 |
+
with word2:
|
53 |
+
button2 = st.button("Chatbot")
|
54 |
+
if button2:
|
55 |
+
self.query = "chatbot"
|
56 |
+
|
57 |
+
with word3:
|
58 |
+
button3 = st.button("Langchain")
|
59 |
+
if button3:
|
60 |
+
self.query = "langchain"
|
61 |
+
|
62 |
+
with word4:
|
63 |
+
button4 = st.button("extension")
|
64 |
+
if button4:
|
65 |
+
self.query = "extension"
|
66 |
+
|
67 |
+
def show_search_results(self):
|
68 |
+
if self.query or self.search_button:
|
69 |
+
st.write("#")
|
70 |
+
|
71 |
+
search_results = self.searcher.search(self.query, k=500)
|
72 |
+
num_search_results = len(search_results)
|
73 |
+
st.write(f"{num_search_results} results")
|
74 |
+
|
75 |
+
for result in search_results:
|
76 |
+
data_json = json.loads(result.raw)
|
77 |
+
description = data_json["description"]
|
78 |
+
url = data_json["url"]
|
79 |
+
project_name = data_json["project_name"]
|
80 |
+
main_topic = data_json["main_topic"]
|
81 |
+
|
82 |
+
st.subheader(f"[{project_name}]({url})")
|
83 |
+
st.markdown(description)
|
84 |
+
st.caption(f"{main_topic}")
|
85 |
+
st.write("#")
|
86 |
+
|
87 |
+
|
88 |
+
def main():
|
89 |
+
SearchApplication()
|
90 |
+
|
91 |
+
|
92 |
+
if __name__ == "__main__":
|
93 |
+
main()
|
indexes/docs/_1.fdm
ADDED
Binary file (157 Bytes). View file
|
|
indexes/docs/_1.fdt
ADDED
Binary file (64.8 kB). View file
|
|
indexes/docs/_1.fdx
ADDED
Binary file (76 Bytes). View file
|
|
indexes/docs/_1.fnm
ADDED
Binary file (343 Bytes). View file
|
|
indexes/docs/_1.nvd
ADDED
Binary file (557 Bytes). View file
|
|
indexes/docs/_1.nvm
ADDED
Binary file (103 Bytes). View file
|
|
indexes/docs/_1.si
ADDED
Binary file (522 Bytes). View file
|
|
indexes/docs/_1.tvd
ADDED
Binary file (32.5 kB). View file
|
|
indexes/docs/_1.tvm
ADDED
Binary file (162 Bytes). View file
|
|
indexes/docs/_1.tvx
ADDED
Binary file (90 Bytes). View file
|
|
indexes/docs/_1_Lucene90_0.doc
ADDED
Binary file (6.25 kB). View file
|
|
indexes/docs/_1_Lucene90_0.dvd
ADDED
Binary file (1.96 kB). View file
|
|
indexes/docs/_1_Lucene90_0.dvm
ADDED
Binary file (171 Bytes). View file
|
|
indexes/docs/_1_Lucene90_0.pos
ADDED
Binary file (6.33 kB). View file
|
|
indexes/docs/_1_Lucene90_0.tim
ADDED
Binary file (22.6 kB). View file
|
|
indexes/docs/_1_Lucene90_0.tip
ADDED
Binary file (671 Bytes). View file
|
|
indexes/docs/_1_Lucene90_0.tmd
ADDED
Binary file (283 Bytes). View file
|
|
indexes/docs/segments_2
ADDED
Binary file (154 Bytes). View file
|
|
indexes/docs/write.lock
ADDED
File without changes
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
openjdk-11-jdk
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pyserini
|
2 |
+
faiss-cpu
|
3 |
+
torch
|