rameshmoorthy
commited on
Commit
•
af4d386
1
Parent(s):
d0811a3
Update app.py
Browse files
app.py
CHANGED
@@ -30,22 +30,23 @@ env = Environment(loader=FileSystemLoader(proj_dir / 'templates'))
|
|
30 |
# Load the templates directly from the environment
|
31 |
template = env.get_template('template.j2')
|
32 |
template_html = env.get_template('template_html.j2')
|
33 |
-
|
34 |
-
#
|
35 |
-
|
36 |
-
#
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
# Examples
|
43 |
examples = ['when i have to report to constituency?','what is social media and what are rules related to it for expenditure monitoring ',
|
44 |
'how many reports to be submitted by Expenditure observer with annexure names ?','what is expenditure limits for parlimentary constituency and assembly constituency'
|
45 |
]
|
46 |
-
|
47 |
-
collection_name = 'Nirvachana' # Replace with your collection name
|
48 |
-
field_name = 'message_count' # Replace with your field name for count
|
49 |
|
50 |
|
51 |
def get_and_increment_value_count(db , collection_name, field_name):
|
@@ -222,14 +223,14 @@ with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
|
|
222 |
prompt_html = gr.HTML()
|
223 |
# Turn off interactivity while generating if you click
|
224 |
txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
225 |
-
bot, [chatbot, cross_encoder], [chatbot, prompt_html])
|
226 |
|
227 |
# Turn it back on
|
228 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
229 |
|
230 |
# Turn off interactivity while generating if you hit enter
|
231 |
txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
232 |
-
bot, [chatbot, cross_encoder], [chatbot, prompt_html])
|
233 |
|
234 |
# Turn it back on
|
235 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
|
|
30 |
# Load the templates directly from the environment
|
31 |
template = env.get_template('template.j2')
|
32 |
template_html = env.get_template('template_html.j2')
|
33 |
+
#___________________
|
34 |
+
# service_account_key='firebase.json'
|
35 |
+
# # Create a Certificate object from the service account info
|
36 |
+
# cred = credentials.Certificate(service_account_key)
|
37 |
+
# # Initialize the Firebase Admin
|
38 |
+
# firebase_admin.initialize_app(cred)
|
39 |
+
|
40 |
+
# # # Create a reference to the Firestore database
|
41 |
+
# db = firestore.client()
|
42 |
+
# #db usage
|
43 |
+
# collection_name = 'Nirvachana' # Replace with your collection name
|
44 |
+
# field_name = 'message_count' # Replace with your field name for count
|
45 |
# Examples
|
46 |
examples = ['when i have to report to constituency?','what is social media and what are rules related to it for expenditure monitoring ',
|
47 |
'how many reports to be submitted by Expenditure observer with annexure names ?','what is expenditure limits for parlimentary constituency and assembly constituency'
|
48 |
]
|
49 |
+
|
|
|
|
|
50 |
|
51 |
|
52 |
def get_and_increment_value_count(db , collection_name, field_name):
|
|
|
223 |
prompt_html = gr.HTML()
|
224 |
# Turn off interactivity while generating if you click
|
225 |
txt_msg = txt_btn.click(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
226 |
+
bot, [chatbot, cross_encoder], [chatbot, prompt_html])#.then(update_count_html,[],[count_html])
|
227 |
|
228 |
# Turn it back on
|
229 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|
230 |
|
231 |
# Turn off interactivity while generating if you hit enter
|
232 |
txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
233 |
+
bot, [chatbot, cross_encoder], [chatbot, prompt_html])#.then(update_count_html,[],[count_html])
|
234 |
|
235 |
# Turn it back on
|
236 |
txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)
|