File size: 3,718 Bytes
c587d34
 
76aa573
 
dff029f
b3b929b
76aa573
dff029f
 
 
 
 
76aa573
 
dff029f
 
b3b929b
b117476
b0a5efe
dff029f
 
 
 
 
 
42e463c
b3b929b
 
 
 
 
 
 
 
 
 
 
 
 
 
dff029f
b3b929b
 
 
 
fabb668
dff029f
b3b929b
 
 
 
 
 
 
c587d34
b3b929b
 
 
 
 
 
 
 
 
 
c587d34
b3b929b
 
dff029f
b3b929b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c587d34
b3b929b
 
 
 
 
 
 
 
76aa573
 
dff029f
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import json
import pandas as pd
import gradio as gr

from src.chat import respond
from src.production.flow import play_fn, stop_fn, reset_fn

custom_theme = gr.themes.Base(
    primary_hue="blue",
    secondary_hue="green",
    neutral_hue="gray",
    font=[gr.themes.GoogleFont("Open Sans"), "sans-serif"],
)

with gr.Blocks(theme=custom_theme) as demo:

        # CHAT_INTERFACE
        gr.Markdown("# AI Industrial Efficiency Helper ⚡️")
        gr.Markdown("### *AI for efficiency in Industries & Services*")
        gr.Markdown(
            """
            This demo showcases the capabilities of IndustryMind AI.
            You can interact with the chatbot to get insights and assistance on production-related queries.
            """
        )
        with gr.Sidebar(width=700, visible=True):
            gr.Markdown("# Ask Agent")
            gr.HTML("<div style='margin-bottom: 20px;'></div>")
            gr.Markdown(
                """
                Ask questions about production processes, equipment, and workflows.
                The chatbot will provide insights and assistance based on the current production data.
                """
            )
            gr.HTML("<div style='margin-bottom: 20px;'></div>")
            gr.Markdown(
                """
                1. **Play** - Start the production simulation and generate synthetic data.
                2. **Ask Questions** - Interact with the chatbot to get insights on production processes.
                3. **Ask for Help** - Get assistance with any issues or queries related to production.

                Note: you can click on `stop` or `reset` to control the production simulation.
                """
            )
            gr.HTML("<div style='margin-bottom: 40px;'></div>")
            chatbot = gr.ChatInterface(respond, type='messages')

        # DASHBOARD
        with gr.Tab("Dashboard"):
            with gr.Row():
                    with gr.Blocks():
                        play = gr.Button("▶️ Play")
                        stop = gr.Button("⏸️ Pause")
                        reset = gr.Button("🔄 Reset")

            with gr.Row():
                with gr.Column(scale=3):
                    df_outputs = {
                        "DataFrame 1": pd.DataFrame(),
                        "DataFrame 2": pd.DataFrame(),
                        "DataFrame 3": pd.DataFrame(),
                        "DataFrame 4": pd.DataFrame(),
                        "DataFrame 5": pd.DataFrame(),
                    }
                    json_output = {}

                    df_components = [gr.DataFrame(label=df_name, visible=True) for df_name in df_outputs.keys()]
                    json_component = gr.JSON(label="Machine JSON", value=json_output, visible=True)

                    play.click(
                            fn=play_fn,
                            inputs=None,
                            outputs=df_components + [json_component]
                    )
                    stop.click(
                        fn=stop_fn,
                        inputs=None,
                        outputs=None
                    )
                    reset.click(
                        fn=reset_fn,
                        inputs=None,
                        outputs=None
                    )

        # DESCRIPTION
        with gr.Tab("Description"):
            gr.Markdown(
                """
                IndustryMind AI is an AI-powered chatbot designed to assist with industrial production processes. 
                It can help you manage production lines, monitor equipment, and optimize workflows.
                """
            )

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