JayWadekar commited on
Commit
96d605c
·
1 Parent(s): 9437ceb
Files changed (1) hide show
  1. app.py +19 -21
app.py CHANGED
@@ -1,5 +1,5 @@
1
  # AI assistant with a RAG system to query information from
2
- # the gwIAS search pipline
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.1-mini-2025-04-14")
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
- greetingsmessage = "Hi, I'm the gwIAS Bot, I'm here to assist you with the search pipeline."
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([{"role": "assistant", "content": greetingsmessage}],
51
- type="messages",
52
- avatar_images=["ims/userpic.png", "ims/gwIASlogo.jpg"],
53
- height="60vh")
 
 
54
 
55
  # Define Gradio interface
56
- demo = gr.ChatInterface(handle_prompt,
57
- type="messages",
58
- title="gwIAS DocBot",
59
- fill_height=True,
60
- examples=example_questions,
61
- theme=gr.themes.Soft(),
62
- description=description,
63
- # cache_examples=False,
64
- chatbot=chatbot)
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()