Spaces:
Sleeping
Sleeping
JayWadekar
commited on
Commit
·
96d605c
1
Parent(s):
9437ceb
update
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
# AI assistant with a RAG system to query information from
|
2 |
-
# the gwIAS search
|
3 |
# using Langchain and deployed with Gradio
|
4 |
|
5 |
from rag import RAG, load_docs
|
@@ -12,7 +12,7 @@ docs = load_docs()
|
|
12 |
print("Pages loaded:", len(docs))
|
13 |
|
14 |
# LLM model
|
15 |
-
llm = ChatOpenAI(model="gpt-4
|
16 |
|
17 |
# Embeddings
|
18 |
embed_model = "sentence-transformers/multi-qa-distilbert-cos-v1"
|
@@ -36,10 +36,9 @@ def handle_prompt(message, history):
|
|
36 |
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
-
|
40 |
# Predefined messages and examples
|
41 |
description = "AI powered assistant to help with [gwIAS](https://github.com/JayWadekar/gwIAS-HM) gravitational wave search pipeline."
|
42 |
-
|
43 |
example_questions = [
|
44 |
"Can you give me the code for calculating coherent score?",
|
45 |
"Which module in the code is used for collecting coincident triggers?",
|
@@ -47,24 +46,23 @@ if __name__ == "__main__":
|
|
47 |
]
|
48 |
|
49 |
# Define customized Gradio chatbot
|
50 |
-
chatbot = gr.Chatbot(
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
54 |
|
55 |
# Define Gradio interface
|
56 |
-
demo = gr.ChatInterface(
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
|
|
66 |
demo.launch()
|
67 |
-
|
68 |
-
# https://arxiv.org/html/2405.17400v2
|
69 |
-
# https://arxiv.org/html/2312.06631v1
|
70 |
-
# https://arxiv.org/html/2310.15233v2
|
|
|
1 |
# AI assistant with a RAG system to query information from
|
2 |
+
# the gwIAS search pipeline
|
3 |
# using Langchain and deployed with Gradio
|
4 |
|
5 |
from rag import RAG, load_docs
|
|
|
12 |
print("Pages loaded:", len(docs))
|
13 |
|
14 |
# LLM model
|
15 |
+
llm = ChatOpenAI(model="gpt-4") # Fixed model name to use a real model
|
16 |
|
17 |
# Embeddings
|
18 |
embed_model = "sentence-transformers/multi-qa-distilbert-cos-v1"
|
|
|
36 |
|
37 |
|
38 |
if __name__ == "__main__":
|
|
|
39 |
# Predefined messages and examples
|
40 |
description = "AI powered assistant to help with [gwIAS](https://github.com/JayWadekar/gwIAS-HM) gravitational wave search pipeline."
|
41 |
+
greeting_message = "Hi, I'm the gwIAS Bot, I'm here to assist you with the search pipeline."
|
42 |
example_questions = [
|
43 |
"Can you give me the code for calculating coherent score?",
|
44 |
"Which module in the code is used for collecting coincident triggers?",
|
|
|
46 |
]
|
47 |
|
48 |
# Define customized Gradio chatbot
|
49 |
+
chatbot = gr.Chatbot(
|
50 |
+
[{"role": "assistant", "content": greeting_message}],
|
51 |
+
type="messages",
|
52 |
+
avatar_images=["ims/userpic.png", "ims/gwIASlogo.jpg"],
|
53 |
+
height="60vh"
|
54 |
+
)
|
55 |
|
56 |
# Define Gradio interface
|
57 |
+
demo = gr.ChatInterface(
|
58 |
+
fn=handle_prompt,
|
59 |
+
chatbot=chatbot,
|
60 |
+
title="gwIAS DocBot",
|
61 |
+
description=description,
|
62 |
+
examples=example_questions,
|
63 |
+
theme=gr.themes.Soft(),
|
64 |
+
fill_height=True
|
65 |
+
)
|
66 |
|
67 |
+
# Launch the interface
|
68 |
demo.launch()
|
|
|
|
|
|
|
|