ppsingh commited on
Commit
d5a9071
1 Parent(s): 3248077

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py CHANGED
@@ -8,6 +8,35 @@ import json
8
  from auditqa.sample_questions import QUESTIONS
9
  from auditqa.reports import POSSIBLE_REPORTS
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # Set up Gradio Theme
12
  theme = gr.themes.Base(
13
  primary_hue="blue",
@@ -17,6 +46,8 @@ theme = gr.themes.Base(
17
 
18
  init_prompt = ""
19
 
 
 
20
  with gr.Blocks(title="Audit Q&A", css="style.css", theme=theme,elem_id = "main-component") as demo:
21
  # user_id_state = gr.State([user_id])
22
 
 
8
  from auditqa.sample_questions import QUESTIONS
9
  from auditqa.reports import POSSIBLE_REPORTS
10
 
11
+
12
+ async def chat(query,history,audience,sources,reports):
13
+ """taking a query and a message history, use a pipeline (reformulation, retriever, answering) to yield a tuple of:
14
+ (messages in gradio format, messages in langchain format, source documents)"""
15
+
16
+ print(f">> NEW QUESTION : {query}")
17
+
18
+ if audience == "Children":
19
+ audience_prompt = audience_prompts["children"]
20
+ elif audience == "General public":
21
+ audience_prompt = audience_prompts["general"]
22
+ elif audience == "Experts":
23
+ audience_prompt = audience_prompts["experts"]
24
+ else:
25
+ audience_prompt = audience_prompts["experts"]
26
+
27
+ # Prepare default values
28
+ if len(sources) == 0:
29
+ sources = ["IPCC"]
30
+
31
+ if len(reports) == 0:
32
+ reports = []
33
+
34
+
35
+
36
+ # --------------------------------------------------------------------
37
+ # Gradio
38
+ # --------------------------------------------------------------------
39
+
40
  # Set up Gradio Theme
41
  theme = gr.themes.Base(
42
  primary_hue="blue",
 
46
 
47
  init_prompt = ""
48
 
49
+
50
+ # Setting Tabs
51
  with gr.Blocks(title="Audit Q&A", css="style.css", theme=theme,elem_id = "main-component") as demo:
52
  # user_id_state = gr.State([user_id])
53