timeki commited on
Commit
f744cd6
1 Parent(s): d75bb08

add questions

Browse files
Files changed (1) hide show
  1. app.py +31 -5
app.py CHANGED
@@ -43,6 +43,13 @@ new_vector_store = FAISS.load_local(
43
 
44
  retriever = new_vector_store.as_retriever()
45
 
 
 
 
 
 
 
 
46
 
47
 
48
  llm = get_llm()
@@ -66,7 +73,7 @@ def make_qa_chain(
66
 
67
  def load_documents_meeting(meeting_number):
68
  # Step 1: Load the CSV data
69
- csv_file_path = "../data/mfls.xlsx"
70
  df = pd.read_excel(csv_file_path)
71
 
72
  df["meeting_number"]= df["Meeting"].apply(lambda x: x.split(" ")[0][:-2])
@@ -183,12 +190,23 @@ with gr.Blocks(title=f"{demo_name}", theme=theme, css_paths=os.getcwd()+ "/style
183
  show_label=False,
184
  placeholder="Input your question then press enter",
185
  )
186
-
187
  with gr.Column(scale=1, variant="panel"):
188
- gr.Markdown("### Sources")
189
- sources_textbox = gr.HTML(show_label=False)
 
 
 
 
 
 
 
 
 
 
 
190
 
191
- ask.submit(
192
  fn=chat,
193
  inputs=[
194
  ask,
@@ -196,6 +214,14 @@ with gr.Blocks(title=f"{demo_name}", theme=theme, css_paths=os.getcwd()+ "/style
196
  ],
197
  outputs=[chatbot, state, sources_textbox],
198
  )
 
 
 
 
 
 
 
 
199
 
200
  ask.submit(reset_textbox, [], [ask])
201
 
 
43
 
44
  retriever = new_vector_store.as_retriever()
45
 
46
+ QUESTIONS = [
47
+ "Give me 10 bullet points to summarize the key decisions of the 94th meeting.",
48
+ "Summarize the policy decisions of the 94th meeting.",
49
+ "Give me an example of a decision that applied a penalty to a country?",
50
+ "Show me the decisions related to end users",
51
+ "Give me a policy on MDI (Metered Dosed Inhalers)",
52
+ ]
53
 
54
 
55
  llm = get_llm()
 
73
 
74
  def load_documents_meeting(meeting_number):
75
  # Step 1: Load the CSV data
76
+ csv_file_path = "data/mfls.xlsx"
77
  df = pd.read_excel(csv_file_path)
78
 
79
  df["meeting_number"]= df["Meeting"].apply(lambda x: x.split(" ")[0][:-2])
 
190
  show_label=False,
191
  placeholder="Input your question then press enter",
192
  )
193
+
194
  with gr.Column(scale=1, variant="panel"):
195
+ with gr.Tabs() as tabs:
196
+ with gr.TabItem("Examples", id= 0):
197
+ example_hidden = gr.Textbox(visible = False)
198
+ examples_questions = gr.Examples(
199
+ QUESTIONS,
200
+ [example_hidden],
201
+ run_on_click=False,
202
+ elem_id=f"examples",
203
+ api_name=f"examples",
204
+ )
205
+ with gr.TabItem("Sources", id= 1):
206
+ gr.Markdown("### Sources")
207
+ sources_textbox = gr.HTML(show_label=False)
208
 
209
+ ask.submit(lambda : gr.update(selected=1), outputs= [tabs]).then(
210
  fn=chat,
211
  inputs=[
212
  ask,
 
214
  ],
215
  outputs=[chatbot, state, sources_textbox],
216
  )
217
+ example_hidden.change(lambda : gr.update(selected=1), outputs= [tabs]).then(
218
+ fn=chat,
219
+ inputs=[
220
+ example_hidden,
221
+ state,
222
+ ],
223
+ outputs=[chatbot, state, sources_textbox],
224
+ )
225
 
226
  ask.submit(reset_textbox, [], [ask])
227