MySQL 설치/이용/삭제

E-commerce Customer Behavior Dataset

from pandasai.llm.local_llm import LocalLLM
import streamlit as st 
from pandasai.connectors import MySQLConnector
from pandasai import SmartDataframe

model = LocalLLM(
    api_base="<http://localhost:11434/v1>",
    model="llama3"
)

my_connector = MySQLConnector(
    config={
        "host": "localhost",
        "port":3306,
        "database":"EComUsr",
        "username":"root",
        "password":"****!",
        "table": "customer"
    }
)

df_connector = SmartDataframe(my_connector, config={"llm":model})

#st.UI-타이틀 
st.title("MySQL with Llama3")

prompt = st.text_input("Enter your prompt:")

if st.button("Generate"):
    if prompt :
        with st.spinner("Generate response.."):
            st.write(df_connector.chat(prompt))
            

스크린샷 2024-06-19 오전 9.27.14.png

스크린샷 2024-06-19 오전 9.28.45.png

스크린샷 2024-06-19 오전 9.34.11.png

스크린샷 2024-06-19 오전 9.36.13.png