Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,4 +20,49 @@ from dotenv import load_dotenv
|
|
| 20 |
load_dotenv()
|
| 21 |
|
| 22 |
HF_token = os.environ["HF_TOKEN"]
|
| 23 |
-
process_pdf()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
load_dotenv()
|
| 21 |
|
| 22 |
HF_token = os.environ["HF_TOKEN"]
|
| 23 |
+
process_pdf()
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# --------------------------------------------------------------------
|
| 27 |
+
# Gradio
|
| 28 |
+
# --------------------------------------------------------------------
|
| 29 |
+
|
| 30 |
+
# Set up Gradio Theme
|
| 31 |
+
theme = gr.themes.Base(
|
| 32 |
+
primary_hue="blue",
|
| 33 |
+
secondary_hue="red",
|
| 34 |
+
font=[gr.themes.GoogleFont("Poppins"), "ui-sans-serif", "system-ui", "sans-serif"],
|
| 35 |
+
text_size = gr.themes.utils.sizes.text_sm,
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
init_prompt = """
|
| 39 |
+
Hello, I am Audit Q&A, a conversational assistant designed to help you understand audit Reports. I will answer your questions by using **Audit reports publishsed by Auditor General Office**.
|
| 40 |
+
💡 How to use (tabs on right)
|
| 41 |
+
- **Reports**: You can choose to address your question to either specific report or a collection of report like District or Ministry focused reports. \
|
| 42 |
+
If you dont select any then the Consolidated report is relied upon to answer your question.
|
| 43 |
+
- **Examples**: We have curated some example questions,select a particular question from category of questions.
|
| 44 |
+
- **Sources**: This tab will display the relied upon paragraphs from the report, to help you in assessing or fact checking if the answer provided by Audit Q&A assitant is correct or not.
|
| 45 |
+
⚠️ For limitations of the tool please check **Disclaimer** tab.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
with gr.Blocks(title="Audit Q&A", css= "style.css", theme=theme,elem_id = "main-component") as demo:
|
| 50 |
+
# user_id_state = gr.State([user_id])
|
| 51 |
+
|
| 52 |
+
with gr.Tab("AuditQ&A"):
|
| 53 |
+
|
| 54 |
+
with gr.Row(elem_id="chatbot-row"):
|
| 55 |
+
with gr.Column(scale=2):
|
| 56 |
+
# state = gr.State([system_template])
|
| 57 |
+
chatbot = gr.Chatbot(
|
| 58 |
+
value=[(None,init_prompt)],
|
| 59 |
+
show_copy_button=True,show_label = False,elem_id="chatbot",layout = "panel",
|
| 60 |
+
avatar_images = (None,"data-collection.png"),
|
| 61 |
+
)#,avatar_images = ("assets/logo4.png",None))
|
| 62 |
+
|
| 63 |
+
# bot.like(vote,None,None)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
with gr.Row(elem_id = "input-message"):
|
| 68 |
+
textbox=gr.Textbox(placeholder="Ask me anything here!",show_label=False,scale=7,lines = 1,interactive = True,elem_id="input-textbox")
|