mriusero commited on
Commit
b3b929b
·
1 Parent(s): c587d34

feat: ui evolve

Browse files
Files changed (2) hide show
  1. app.py +66 -47
  2. src/production/flow.py +1 -1
app.py CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
3
  import gradio as gr
4
 
5
  from src.chat import respond
6
- from src.production.flow import play_fn, pause_fn, reset_fn
7
 
8
  custom_theme = gr.themes.Base(
9
  primary_hue="blue",
@@ -14,64 +14,83 @@ custom_theme = gr.themes.Base(
14
 
15
  with gr.Blocks(theme=custom_theme) as demo:
16
 
17
- gr.Markdown("# IndustryMind AI ⚡️")
18
- gr.Markdown("## An industrial production intelligence (WIP)")
19
-
20
- with gr.Tab("Demo"):
21
  gr.Markdown(
22
  """
23
  This demo showcases the capabilities of IndustryMind AI.
24
  You can interact with the chatbot to get insights and assistance on production-related queries.
25
  """
26
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- with gr.Row():
29
- with gr.Column(scale=1):
30
- chatbot = gr.ChatInterface(respond)
31
- with gr.Row():
32
- with gr.Column(scale=2):
33
- with gr.Group():
34
- play = gr.Button("▶️ Play")
35
- pause = gr.Button("⏸️ Pause")
36
- reset = gr.Button("🔄 Reset")
37
 
38
- with gr.Column(scale=3):
39
- df_outputs = {
40
- "DataFrame 1": pd.DataFrame(),
41
- "DataFrame 2": pd.DataFrame(),
42
- "DataFrame 3": pd.DataFrame(),
43
- "DataFrame 4": pd.DataFrame(),
44
- "DataFrame 5": pd.DataFrame(),
45
- }
46
- json_output = {}
47
 
48
- df_components = [gr.DataFrame(label=df_name, visible=False) for df_name in df_outputs.keys()]
49
- json_component = gr.JSON(label="Machine JSON", value=json_output, visible=False)
 
 
 
 
 
 
 
 
50
 
51
- play.click(
52
- fn=play_fn,
53
- inputs=None,
54
- outputs=df_components + [json_component]
55
- )
56
- pause.click(
57
- fn=pause_fn,
58
- inputs=None,
59
- outputs=None
60
- )
61
- reset.click(
62
- fn=reset_fn,
63
- inputs=None,
64
- outputs=None
65
- )
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- with gr.Tab("Description"):
69
- gr.Markdown(
70
- """
71
- IndustryMind AI is an AI-powered chatbot designed to assist with industrial production processes.
72
- It can help you manage production lines, monitor equipment, and optimize workflows.
73
- """
74
- )
 
75
 
76
  if __name__ == "__main__":
77
  demo.launch()
 
3
  import gradio as gr
4
 
5
  from src.chat import respond
6
+ from src.production.flow import play_fn, stop_fn, reset_fn
7
 
8
  custom_theme = gr.themes.Base(
9
  primary_hue="blue",
 
14
 
15
  with gr.Blocks(theme=custom_theme) as demo:
16
 
17
+ # CHAT_INTERFACE
18
+ gr.Markdown("# IndustryMind AI ⚡️")
19
+ gr.Markdown("### *An industrial production intelligence (WIP)*")
 
20
  gr.Markdown(
21
  """
22
  This demo showcases the capabilities of IndustryMind AI.
23
  You can interact with the chatbot to get insights and assistance on production-related queries.
24
  """
25
  )
26
+ with gr.Sidebar(width=700, visible=False):
27
+ gr.Markdown("# Ask Agent")
28
+ gr.HTML("<div style='margin-bottom: 20px;'></div>")
29
+ gr.Markdown(
30
+ """
31
+ Ask questions about production processes, equipment, and workflows.
32
+ The chatbot will provide insights and assistance based on the current production data.
33
+ """
34
+ )
35
+ gr.HTML("<div style='margin-bottom: 20px;'></div>")
36
+ gr.Markdown(
37
+ """
38
+ 1. **Play** - Start the production simulation and generate synthetic data.
39
+ 2. **Ask Questions** - Interact with the chatbot to get insights on production processes.
40
+ 3. **Ask for Help** - Get assistance with any issues or queries related to production.
41
 
42
+ Note: you can click on `stop` or `reset` to control the production simulation.
43
+ """
44
+ )
45
+ gr.HTML("<div style='margin-bottom: 40px;'></div>")
46
+ chatbot = gr.ChatInterface(respond)
 
 
 
 
47
 
48
+ # DASHBOARD
49
+ with gr.Tab("Dashboard"):
50
+ with gr.Row():
51
+ with gr.Blocks():
52
+ play = gr.Button("▶️ Play")
53
+ stop = gr.Button("⏸️ Pause")
54
+ reset = gr.Button("🔄 Reset")
 
 
55
 
56
+ with gr.Row():
57
+ with gr.Column(scale=3):
58
+ df_outputs = {
59
+ "DataFrame 1": pd.DataFrame(),
60
+ "DataFrame 2": pd.DataFrame(),
61
+ "DataFrame 3": pd.DataFrame(),
62
+ "DataFrame 4": pd.DataFrame(),
63
+ "DataFrame 5": pd.DataFrame(),
64
+ }
65
+ json_output = {}
66
 
67
+ df_components = [gr.DataFrame(label=df_name, visible=True) for df_name in df_outputs.keys()]
68
+ json_component = gr.JSON(label="Machine JSON", value=json_output, visible=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
+ play.click(
71
+ fn=play_fn,
72
+ inputs=None,
73
+ outputs=df_components + [json_component]
74
+ )
75
+ stop.click(
76
+ fn=stop_fn,
77
+ inputs=None,
78
+ outputs=None
79
+ )
80
+ reset.click(
81
+ fn=reset_fn,
82
+ inputs=None,
83
+ outputs=None
84
+ )
85
 
86
+ # DESCRIPTION
87
+ with gr.Tab("Description"):
88
+ gr.Markdown(
89
+ """
90
+ IndustryMind AI is an AI-powered chatbot designed to assist with industrial production processes.
91
+ It can help you manage production lines, monitor equipment, and optimize workflows.
92
+ """
93
+ )
94
 
95
  if __name__ == "__main__":
96
  demo.launch()
src/production/flow.py CHANGED
@@ -118,7 +118,7 @@ def play_fn():
118
  yield [tools_dfs[key] for key in tools_dfs.keys()] + [machine_json]
119
 
120
 
121
- def pause_fn():
122
  """
123
  Pause the production simulation.
124
  """
 
118
  yield [tools_dfs[key] for key in tools_dfs.keys()] + [machine_json]
119
 
120
 
121
+ def stop_fn():
122
  """
123
  Pause the production simulation.
124
  """