mdevora commited on
Commit
8a1cbe0
·
1 Parent(s): 2001163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -85,7 +85,8 @@ loader = UnstructuredURLLoader(urls=['https://sherlock-ph.readthedocs.io/en/late
85
  'https://github.com/franpoz/SHERLOCK',
86
  'https://github.com/PlanetHunters/watson',
87
  'https://github.com/PlanetHunters/tkmatrix',
88
- 'https://github.com/iaa-so-training/sherlock-tutorial/tree/main'])
 
89
  url_documents = loader.load()
90
  def wrap_text_preserve_newlines(text, width=110):
91
  # Split the input text into lines based on newline characters
@@ -117,9 +118,11 @@ model_kwargs = {"max_length": max_length, "pad_token_id": 50256, "pad_token": "[
117
  # "padding": 'longest' #for open end generation
118
  # })
119
  llm = ChatOpenAI(streaming=True, callbacks=[StreamingStdOutCallbackHandler()], model_name=model_name, temperature=0.9)
120
- prompt_template = """I will ask about tools, techniques and discoveries about the exoplanets field. You are going to receive a context with information about
121
- related works for the PhD of Martín Dévora with his developments and referenced works. You can only answer things based on the context and if you find that the
122
- question can't be answered from the context, just respond that you don't know.
 
 
123
  Context: {context}
124
  Question: {question}"""
125
 
@@ -142,14 +145,13 @@ def chat(message, history):
142
  # print(f"Answer: {response['result']}")
143
  # print(f"Sources: {response['source_documents']}")
144
 
145
- gr.ChatInterface(chat, chatbot=gr.Chatbot(height=300),
146
  textbox=gr.Textbox(placeholder="Ask me about Voutique!", container=False, scale=7),
147
- title="Ask",
148
- description="Ask",
149
  theme="soft",
150
  examples=["What is SHERLOCK?", "What is MATRIX?", "What are the foundational papers of SHERLOCK?"],
151
  cache_examples=True,
152
  retry_btn=None,
153
  undo_btn="Delete Previous",
154
  clear_btn="Clear").queue().launch()
155
-
 
85
  'https://github.com/franpoz/SHERLOCK',
86
  'https://github.com/PlanetHunters/watson',
87
  'https://github.com/PlanetHunters/tkmatrix',
88
+ 'https://github.com/iaa-so-training/sherlock-tutorial/tree/main',
89
+ 'https://github.com/franpoz/SHERLOCK/blob/master/sherlockpipe/properties.yaml'])
90
  url_documents = loader.load()
91
  def wrap_text_preserve_newlines(text, width=110):
92
  # Split the input text into lines based on newline characters
 
118
  # "padding": 'longest' #for open end generation
119
  # })
120
  llm = ChatOpenAI(streaming=True, callbacks=[StreamingStdOutCallbackHandler()], model_name=model_name, temperature=0.9)
121
+ prompt_template = """I will ask about tools, techniques and discoveries about the exoplanets field. You are going to
122
+ receive a context with information about related works, papers and tools for the PhD of Martín Dévora Pajares,
123
+ also appearing as M. Dévora-Pajares.
124
+ You can only answer things based on the context and if you find that the question can't be answered from the context,
125
+ just respond that you don't know.
126
  Context: {context}
127
  Question: {question}"""
128
 
 
145
  # print(f"Answer: {response['result']}")
146
  # print(f"Sources: {response['source_documents']}")
147
 
148
+ gr.ChatInterface(chat, chatbot=gr.Chatbot(),
149
  textbox=gr.Textbox(placeholder="Ask me about Voutique!", container=False, scale=7),
150
+ title="PlanetHunters tools and works information Chatbot!",
151
+ description="Ask anything about SHERLOCK, MATRIX, WATSON and our history of papers!",
152
  theme="soft",
153
  examples=["What is SHERLOCK?", "What is MATRIX?", "What are the foundational papers of SHERLOCK?"],
154
  cache_examples=True,
155
  retry_btn=None,
156
  undo_btn="Delete Previous",
157
  clear_btn="Clear").queue().launch()