SarowarSaurav
commited on
Commit
•
1bcd1f6
1
Parent(s):
3437eff
Update app.py
Browse files
app.py
CHANGED
@@ -3745,7 +3745,8 @@ knowledge_base = {
|
|
3745 |
def chatbot_interface(acronym):
|
3746 |
acronym = acronym.strip().upper() # Remove leading/trailing whitespace and convert to uppercase
|
3747 |
if acronym in knowledge_base:
|
3748 |
-
|
|
|
3749 |
else:
|
3750 |
closest_match = difflib.get_close_matches(acronym, knowledge_base.keys(), n=1)
|
3751 |
if closest_match:
|
@@ -3767,13 +3768,19 @@ footer {
|
|
3767 |
}
|
3768 |
"""
|
3769 |
|
3770 |
-
# HTML content for the logo
|
3771 |
html_content = """
|
3772 |
<div style="text-align: center; margin-bottom: 20px;">
|
3773 |
<img src="https://i.ibb.co/82Qf4rc/APMEA-CENTRAL-White.png" border="0" alt='BAT Bangladesh Logo' style='max-width: 300px;'>
|
3774 |
</div>
|
3775 |
"""
|
3776 |
|
|
|
|
|
|
|
|
|
|
|
|
|
3777 |
with gr.Blocks(css=css) as demo:
|
3778 |
gr.HTML(html_content)
|
3779 |
gr.Interface(
|
@@ -3782,5 +3789,6 @@ with gr.Blocks(css=css) as demo:
|
|
3782 |
outputs=gr.Textbox(label="Answer"),
|
3783 |
theme='default',
|
3784 |
)
|
|
|
3785 |
|
3786 |
demo.launch(allowed_paths=["."])
|
|
|
3745 |
def chatbot_interface(acronym):
|
3746 |
acronym = acronym.strip().upper() # Remove leading/trailing whitespace and convert to uppercase
|
3747 |
if acronym in knowledge_base:
|
3748 |
+
# Split the definitions by '/' and join with new lines
|
3749 |
+
response = "According to BATCCAPEDIA:\n" + "\n".join(knowledge_base[acronym].split(" / "))
|
3750 |
else:
|
3751 |
closest_match = difflib.get_close_matches(acronym, knowledge_base.keys(), n=1)
|
3752 |
if closest_match:
|
|
|
3768 |
}
|
3769 |
"""
|
3770 |
|
3771 |
+
# HTML content for the logo and footer
|
3772 |
html_content = """
|
3773 |
<div style="text-align: center; margin-bottom: 20px;">
|
3774 |
<img src="https://i.ibb.co/82Qf4rc/APMEA-CENTRAL-White.png" border="0" alt='BAT Bangladesh Logo' style='max-width: 300px;'>
|
3775 |
</div>
|
3776 |
"""
|
3777 |
|
3778 |
+
footer_content = """
|
3779 |
+
<div style="text-align: center; margin-top: 20px; color: white;">
|
3780 |
+
If any of the acronyms are missing, please mail the acronyms to <a href="mailto:[email protected]" style="color: #ffffff;">[email protected]</a>
|
3781 |
+
</div>
|
3782 |
+
"""
|
3783 |
+
|
3784 |
with gr.Blocks(css=css) as demo:
|
3785 |
gr.HTML(html_content)
|
3786 |
gr.Interface(
|
|
|
3789 |
outputs=gr.Textbox(label="Answer"),
|
3790 |
theme='default',
|
3791 |
)
|
3792 |
+
gr.HTML(footer_content)
|
3793 |
|
3794 |
demo.launch(allowed_paths=["."])
|