Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from utils.search_utils import find_relevant_bounty
|
3 |
+
|
4 |
+
def chatbot_response(user_query):
|
5 |
+
# Find the most relevant bounty
|
6 |
+
bounty = find_relevant_bounty(user_query)
|
7 |
+
if bounty:
|
8 |
+
return (
|
9 |
+
f"Title: {bounty['title']}\n"
|
10 |
+
f"Description: {bounty['description']}\n"
|
11 |
+
f"Answer: {bounty['answer']}\n"
|
12 |
+
f"Score: {bounty['score']}\n"
|
13 |
+
)
|
14 |
+
else:
|
15 |
+
return "No relevant bounties found."
|
16 |
+
|
17 |
+
# Gradio interface
|
18 |
+
interface = gr.Interface(
|
19 |
+
fn=chatbot_response,
|
20 |
+
inputs="text",
|
21 |
+
outputs="text",
|
22 |
+
title="Big Bounty Search Chatbot"
|
23 |
+
)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
interface.launch()
|