File size: 1,124 Bytes
098098d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from text_rag import get_response
import json
import os

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=brand_info["organizationName"]) as rag_bot:
    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="width:200px;height:40px">

            </div> """)
    
    gr.ChatInterface(
        fn=get_response,
        chatbot=gr.Chatbot(height=500, avatar_images=(None, brand_info["chatbot"]["avatar"]), type="messages"),
        title=brand_info["organizationName"],
        description=brand_info["slogan"],
        type="messages",
        examples=[
            ["Who is the CEO of Here and Now AI?"],
            ["What is the mission of Here and Now AI?"],
            ["Tell me about the team behind Here and Now AI."]
           
        ]
    )    

if __name__ == "__main__":
    rag_bot.launch()