Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -51,8 +51,9 @@ with gr.Blocks(title="Audit Q&A", css= "style.css", theme=theme,elem_id = "main-
|
|
51 |
# main tab where chat interaction happens
|
52 |
# ---------------------------------------------------------------------------------------------
|
53 |
with gr.Tab("AuditQ&A"):
|
54 |
-
|
55 |
with gr.Row(elem_id="chatbot-row"):
|
|
|
56 |
with gr.Column(scale=2):
|
57 |
chatbot = gr.Chatbot(
|
58 |
value=[(None,init_prompt)],
|
@@ -64,19 +65,51 @@ with gr.Blocks(title="Audit Q&A", css= "style.css", theme=theme,elem_id = "main-
|
|
64 |
|
65 |
|
66 |
with gr.Row(elem_id = "input-message"):
|
67 |
-
textbox=gr.Textbox(placeholder="Ask me anything here!",show_label=False,scale=7,
|
|
|
68 |
|
69 |
# second column with playground area for user to select values
|
70 |
with gr.Column(scale=1, variant="panel",elem_id = "right-panel"):
|
71 |
# creating tabs on right panel
|
72 |
with gr.Tabs() as tabs:
|
|
|
73 |
with gr.Tab("Reports",elem_id = "tab-config",id = 2):
|
74 |
gr.Markdown("Reminder: To get better results select the specific report/reports")
|
75 |
|
|
|
76 |
with gr.TabItem("Examples",elem_id = "tab-examples",id = 0):
|
77 |
-
gr.
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
with gr.Tab("Sources",elem_id = "tab-citations",id = 1):
|
|
|
|
|
80 |
gr.Markdown("Reminder: To get better results select the specific report/reports")
|
81 |
|
82 |
|
|
|
51 |
# main tab where chat interaction happens
|
52 |
# ---------------------------------------------------------------------------------------------
|
53 |
with gr.Tab("AuditQ&A"):
|
54 |
+
|
55 |
with gr.Row(elem_id="chatbot-row"):
|
56 |
+
# chatbot output screen
|
57 |
with gr.Column(scale=2):
|
58 |
chatbot = gr.Chatbot(
|
59 |
value=[(None,init_prompt)],
|
|
|
65 |
|
66 |
|
67 |
with gr.Row(elem_id = "input-message"):
|
68 |
+
textbox=gr.Textbox(placeholder="Ask me anything here!",show_label=False,scale=7,
|
69 |
+
lines = 1,interactive = True,elem_id="input-textbox")
|
70 |
|
71 |
# second column with playground area for user to select values
|
72 |
with gr.Column(scale=1, variant="panel",elem_id = "right-panel"):
|
73 |
# creating tabs on right panel
|
74 |
with gr.Tabs() as tabs:
|
75 |
+
################## tab for REPORTS SELECTION ##########
|
76 |
with gr.Tab("Reports",elem_id = "tab-config",id = 2):
|
77 |
gr.Markdown("Reminder: To get better results select the specific report/reports")
|
78 |
|
79 |
+
############### tab for Question selection ###############
|
80 |
with gr.TabItem("Examples",elem_id = "tab-examples",id = 0):
|
81 |
+
examples_hidden = gr.Textbox(visible = False)
|
82 |
+
|
83 |
+
# getting defualt key value to display
|
84 |
+
first_key = list(QUESTIONS.keys())[0]
|
85 |
+
# create the question category dropdown
|
86 |
+
dropdown_samples = gr.Dropdown(QUESTIONS.keys(),value = first_key,
|
87 |
+
interactive = True,show_label = True,
|
88 |
+
label = "Select a category of sample questions",
|
89 |
+
elem_id = "dropdown-samples")
|
90 |
+
|
91 |
+
|
92 |
+
# iterate through the questions list
|
93 |
+
samples = []
|
94 |
+
for i,key in enumerate(QUESTIONS.keys()):
|
95 |
+
examples_visible = True if i == 0 else False
|
96 |
+
with gr.Row(visible = examples_visible) as group_examples:
|
97 |
+
examples_questions = gr.Examples(
|
98 |
+
QUESTIONS[key],
|
99 |
+
[examples_hidden],
|
100 |
+
examples_per_page=8,
|
101 |
+
run_on_click=False,
|
102 |
+
elem_id=f"examples{i}",
|
103 |
+
api_name=f"examples{i}",
|
104 |
+
# label = "Click on the example question or enter your own",
|
105 |
+
# cache_examples=True,
|
106 |
+
)
|
107 |
+
|
108 |
+
samples.append(group_examples)
|
109 |
+
########## tab for Sources reporting #################
|
110 |
with gr.Tab("Sources",elem_id = "tab-citations",id = 1):
|
111 |
+
sources_textbox = gr.HTML(show_label=False, elem_id="sources-textbox")
|
112 |
+
docs_textbox = gr.State("")
|
113 |
gr.Markdown("Reminder: To get better results select the specific report/reports")
|
114 |
|
115 |
|