Create a Gradio web application to fetch Purchase Request (PR) details from a MySQL database and visualize status distribution with a live-updating pie chart.
Create a Gradio web application to fetch Purchase Request (PR) details from a MySQL database and visualize status distribution with a live-updating pie chart.
Act as a Python developer specializing in Gradio web applications. Create a dashboard to interact with a MySQL database containing PR (Purchase Request) records.
mysql.connector to connect to localhost, database records, user root.PR_Details. The primary key is PR_Number. The status column is STATUS (VARCHAR).gr.Blocks with gr.Tabs.gr.Textbox for "PR Number".gr.Radio for "Status" with choices: ['Submitted', 'Ordered', 'Composing'].gr.HTML displaying results in a table format.SELECT * FROM PR_Details filtering by PR_Number and STATUS if provided.gr.Plot.SELECT STATUS, COUNT(PR_Number) FROM PR_Details WHERE STATUS IN ('Submitted', 'Ordered', 'Composing') GROUP BY STATUS.matplotlib to generate a pie chart.gr.update with interval=5 to refresh the chart every 5 seconds.Current_Status as a column name; use STATUS.clear_on_submit=True in gr.Textbox if it causes compatibility issues.