File size: 2,554 Bytes
c587d34
 
76aa573
 
dff029f
4c16235
76aa573
dff029f
 
 
 
 
76aa573
 
dff029f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c16235
 
 
dff029f
c587d34
 
 
 
 
 
 
 
 
 
 
 
 
4c16235
 
 
c587d34
 
4c16235
 
 
 
 
 
 
 
 
 
dff029f
c587d34
dff029f
 
 
 
 
 
 
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
import json
import pandas as pd
import gradio as gr

from src.chat import respond
from src.production.flow import play_fn, pause_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:

    gr.Markdown("# IndustryMind AI ⚡️")
    gr.Markdown("## An industrial production intelligence (WIP)")

    with gr.Tab("Demo"):
        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.Row():
            with gr.Column(scale=1):
                chatbot = gr.ChatInterface(respond)
                with gr.Row():
                    with gr.Column(scale=2):
                        with gr.Group():
                            play = gr.Button("▶️ Play")
                            pause = gr.Button("⏸️ Pause")
                            reset = gr.Button("🔄 Reset")

            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=False) for df_name in df_outputs.keys()]
                json_component = gr.JSON(label="Machine JSON", value=json_output, visible=False)

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


    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()