Spaces:
Sleeping
Sleeping
File size: 2,644 Bytes
49655be f8d9c8a 42500ca ab7f293 7528ee2 49655be 8346afa 49655be 8346afa 49655be a9effa1 49655be a9effa1 9ef3aa7 a9effa1 3d63627 9ef3aa7 a9effa1 9ef3aa7 a9effa1 7528ee2 8346afa 7528ee2 |
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 |
import gradio as gr
from src.agent.stream import respond
def sidebar_ui(state, width=700, visible=True):
with gr.Sidebar(width=width, visible=visible):
gr.Markdown("# Ask Agent")
gr.Markdown(
"""
Ask questions about production quality, efficiency, or issues.
The chatbot will provide insights and assistance based on the current production data.
"""
)
gr.Markdown(
"""
1. **Play** - Start the production simulation and generate synthetic data.
2. **Ask Agent** - Interact with the chatbot to get insights on production process, any issues and more.
Note: you can click on `Pause` or `Reset` to control the production simulation.
"""
)
with gr.Blocks():
with gr.Row(height=800):
with gr.Tabs():
with gr.TabItem("Agent"):
chatbot = gr.ChatInterface(
fn=respond,
type="messages",
multimodal=False,
chatbot=gr.Chatbot(
placeholder="⚡️ How can I help you today ?",
type="messages",
height=600,
show_copy_button=True,
),
show_progress='full',
stop_btn=True,
save_history=True,
examples=[
# ["What is the sum of 1+1 ?"],
["How is the production process going?"],
["What are the common downtimes faced in production?"],
["Can you explain me Cp & Cpk KPIs ?"],
# ["Can you provide insights on equipment performance?"],
# ["How can I optimize the workflow in the production area?"],
# ["How do I troubleshoot a specific piece of equipment?"],
# ["What are the best practices for maintaining production efficiency?"]
],
cache_examples=False
)
sessions_state = gr.JSON(
label="Sessions State",
visible=False,
value=state.value,
)
state.change(
fn=lambda x: x,
inputs=state,
outputs=sessions_state,
) |