File size: 989 Bytes
0a6f6d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# import libraries
import gradio as gr

# import functions
from src.test.eval_rag import load_eval_questions


# create chatbot interface
def create_chatinterface(generate_response):
    """
    Instantiates the gradio chat interface.

    Args:
        generate_response (callable): Function that generates the response.

    Returns:
        class: Returns gradio chatinterface class
    """

    chat_interface = gr.ChatInterface(
        fn=generate_response,
        textbox=gr.Textbox(
            placeholder="Type your question here!", container=False, scale=7
        ),
        title="OpenPages IntelliBot",
        description="Ask me about OpenPages (v9.0), its features, solutions / modules it offers and the trigger framework. Authored by Nikhil Komakula (nikhil.komakula@outlook.com).",
        theme=gr.themes.Default(primary_hue="blue"),
        examples=load_eval_questions(),
        cache_examples=False,
        concurrency_limit=None
    )

    return chat_interface