Spaces:
Sleeping
Sleeping
File size: 2,113 Bytes
c38572f 3e92877 ea1a518 c38572f 840b617 ea1a518 b6ea428 b4a06db eb5edf8 b4a06db c38572f b4a06db eb5edf8 b4a06db c38572f ea1a518 c38572f ea1a518 c38572f c811bcc ea1a518 c38572f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# Necessary Imports
import warnings
warnings.filterwarnings("ignore")
import gradio as gr
# Import the necessary functions from the src folder
from src.app.chat import query_message
from src.app.llm_response import llm_response
# HTML Content for the Interface
TITLE = """<h1 align="center">Well Being π¬</h1>"""
SUBTITLE = """<h2 align="center">End Preventable Child Deaths: Join the Global Effort to Save Children's Lives!</h2>"""
DESCRIPTION = """
<div
style="
text-align: center;
display: flex;
justify-content: center;
align-items: center;
"
>
<p>
We aim to reduce child mortality globally. πΆπ» Our goals are under-5
mortality of β€25 per 1,000 live births π and neonatal mortality of β€12 per
1,000. π This requires preventing newborn and early childhood deaths
worldwide. β Together, we can give every child a healthy start to life! π
</p>
</div>
"""
# Interface Code using Gradio
with gr.Blocks(theme=gr.themes.Soft()) as app:
# Add HTML Content
gr.HTML(TITLE)
gr.HTML(SUBTITLE)
gr.HTML(DESCRIPTION)
with gr.Row():
# Image UI
image_box = gr.Image(type="filepath", height=750)
# Chat UI
chatbot = gr.Chatbot(
scale=2,
height=750,
type="tuples",
show_share_button=True,
show_copy_button=True,
examples=[
{
"text": "Hello! and welcome to Well Being π¬",
"image": None,
},
{
"text": "Chat with me to get started! π",
"image": None,
},
],
)
text_box = gr.Textbox(
placeholder="Enter your message here...",
container=True,
)
# Button to Submit the Input and Generate Response
btn = gr.Button("Submit")
clicked = btn.click(query_message, [chatbot, text_box, image_box], chatbot).then(
llm_response, [chatbot, text_box, image_box], chatbot
)
# Launch the Interface
app.queue()
app.launch(debug=False)
|