newChatbot / ui.py
npcJensen's picture
Upload 15 files
e0225ee verified
#hello this is jensen
import gradio as gr
from chatbot_memory import get_response
import os
import json
with open(os.path.abspath(os.path.join(os.path.dirname(__file__),"branding.json"))) as f:
brand_info=json.load(f)["brand"]
with gr.Blocks(theme="default",title=["organizationName"]) as app:
gr.HTML(f"""<div style="display":flex justify-content:center; margin-bottom:20px;">
<img src="{brand_info["logo"]["title"]}" alt="{brand_info["organizationName"]} logo" style="height:100px;">)
</div>""")
gr.ChatInterface(
fn=get_response,
chatbot=gr.Chatbot(height=500,avatar_images=(None,brand_info["chatbot"]["avatar"]),
type="messages"),
title=brand_info ["organizationName"],
type="messages",
examples=[["If you could have any superpower, what would it be and why? "],
["Who is Queen Elizabeth?"]
]
)
if __name__ == "__main__":
app.launch()