Spaces:
Sleeping
Sleeping
added image and re-arranged info about app.
Browse files- app.py +45 -40
- images/arena.png +0 -0
app.py
CHANGED
@@ -14,30 +14,38 @@ import uuid
|
|
14 |
st.set_page_config(layout="wide", page_title="SearchArena")
|
15 |
|
16 |
# Add information to sidebar
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
# Submit a question, and you'll receive answers from two randomly selected search engines.
|
21 |
-
# You can then vote on which response you prefer.
|
22 |
-
# """)
|
23 |
-
# st.sidebar.write("""
|
24 |
-
# **[GitHub](https://github.com/leowalker89/SearchArena)**""")
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
st.header("Welcome to Search Arena")
|
31 |
-
st.write("""
|
32 |
-
Welcome to Search Arena, an open platform for evaluating and comparing search providers through crowdsourced preferences. Inspired by the groundbreaking work of LMSYS's Chatbot Arena in benchmarking large language models (LLMs), Search Arena aims to bring a similar approach to the world of search.
|
33 |
|
34 |
-
|
35 |
|
36 |
-
|
37 |
|
38 |
-
|
39 |
""")
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# Define the function to process the question
|
42 |
def ProcessQuestion(question):
|
43 |
document_id = None
|
@@ -91,29 +99,6 @@ def UpdateFeedback(session_id, feedback):
|
|
91 |
except Exception as e:
|
92 |
print(f"Error updating feedback in mongodb: {e}")
|
93 |
|
94 |
-
|
95 |
-
# Initialize session state if not already done
|
96 |
-
default_values = {
|
97 |
-
"state": "arena_ready",
|
98 |
-
"question": "",
|
99 |
-
"answer_a": "",
|
100 |
-
"answer_b": "",
|
101 |
-
"source_a": "",
|
102 |
-
"source_b": "",
|
103 |
-
"winner": "",
|
104 |
-
"selected_button": "",
|
105 |
-
"document_id": "",
|
106 |
-
"feedback": "",
|
107 |
-
"session_id": str(uuid.uuid4())
|
108 |
-
}
|
109 |
-
|
110 |
-
for key, value in default_values.items():
|
111 |
-
if key not in st.session_state:
|
112 |
-
st.session_state[key] = value
|
113 |
-
|
114 |
-
# Streamlit app layout
|
115 |
-
st.title("Search Engine Agent Comparison")
|
116 |
-
|
117 |
def on_submit():
|
118 |
question = st.session_state["question_input"]
|
119 |
if question:
|
@@ -216,6 +201,26 @@ def render_results_state():
|
|
216 |
st.write(f"**Website:** [{provider_info_b['website']}]({provider_info_b['website']})")
|
217 |
st.write(f"**Overview:** {provider_info_b['overview']}")
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
if st.session_state["state"] == "arena_ready":
|
220 |
render_ready_state()
|
221 |
elif st.session_state["state"] == "arena_review":
|
|
|
14 |
st.set_page_config(layout="wide", page_title="SearchArena")
|
15 |
|
16 |
# Add information to sidebar
|
17 |
+
st.sidebar.title("About the App")
|
18 |
+
st.sidebar.write("""
|
19 |
+
Welcome to Search Arena, an open platform for evaluating and comparing search providers.
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
**How it works:**
|
22 |
+
1. Enter a single question in the text area.
|
23 |
+
2. Receive answers from two anonymous search providers.
|
24 |
+
3. Review the answers and vote for the one that you prefer.
|
25 |
+
4. After voting, the identities of the search providers will be revealed.
|
26 |
+
5. You can also provide feedback on your choice.
|
27 |
+
|
28 |
+
**Search Providers:**
|
29 |
+
- [Tavily](https://tavily.com/)
|
30 |
+
- [Brave Search](https://brave.com/search/api)
|
31 |
+
- [Perplexity AI](https://docs.perplexity.ai/)
|
32 |
+
- [You.com](https://api.you.com/)
|
33 |
|
34 |
+
Each search provider has its unique features and capabilities. After voting, you can learn more about the providers and their offerings.
|
|
|
|
|
|
|
35 |
|
36 |
+
**[GitHub](https://github.com/leowalker89/SearchArena)**
|
37 |
|
38 |
+
**[LinkedIn](https://www.linkedin.com/in/leowalker89/)**
|
39 |
|
40 |
+
**[X/Twitter](https://twitter.com/leowalker9)**
|
41 |
""")
|
42 |
|
43 |
+
# Header section
|
44 |
+
st.title("⚔️ Search Arena: Comparing Search Providers")
|
45 |
+
|
46 |
+
# Display the image
|
47 |
+
st.image("images/arena.png", use_column_width=True)
|
48 |
+
|
49 |
# Define the function to process the question
|
50 |
def ProcessQuestion(question):
|
51 |
document_id = None
|
|
|
99 |
except Exception as e:
|
100 |
print(f"Error updating feedback in mongodb: {e}")
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
def on_submit():
|
103 |
question = st.session_state["question_input"]
|
104 |
if question:
|
|
|
201 |
st.write(f"**Website:** [{provider_info_b['website']}]({provider_info_b['website']})")
|
202 |
st.write(f"**Overview:** {provider_info_b['overview']}")
|
203 |
|
204 |
+
|
205 |
+
# Initialize session state if not already done
|
206 |
+
default_values = {
|
207 |
+
"state": "arena_ready",
|
208 |
+
"question": "",
|
209 |
+
"answer_a": "",
|
210 |
+
"answer_b": "",
|
211 |
+
"source_a": "",
|
212 |
+
"source_b": "",
|
213 |
+
"winner": "",
|
214 |
+
"selected_button": "",
|
215 |
+
"document_id": "",
|
216 |
+
"feedback": "",
|
217 |
+
"session_id": str(uuid.uuid4())
|
218 |
+
}
|
219 |
+
|
220 |
+
for key, value in default_values.items():
|
221 |
+
if key not in st.session_state:
|
222 |
+
st.session_state[key] = value
|
223 |
+
|
224 |
if st.session_state["state"] == "arena_ready":
|
225 |
render_ready_state()
|
226 |
elif st.session_state["state"] == "arena_review":
|
images/arena.png
ADDED