Postavite PandasAI i Ollama Lokalno u Par Koraka

Evo koraka za instaliranje svega što vam je potrebno i pokretanje PandasAI lokalno:


Postavljanje virtualnog okruženja i instaliranje alata


Prvo, kreirajte virtualno okruženje koristeći conda. Na primjer: conda create -n genai 


Aktivirajte okruženje: conda activate genai


Kreirajte datoteku requirements.txt i u nju upišite sljedeće biblioteke: langchain, langchain_community, pandasai, ollama i streamlit


Instalirajte biblioteke koristeći pip: pip install -r requirements.txt 


Instaliranje i pokretanje Ollama


    Preuzmite Ollama s web stranice i instalirajte ga na svoje računalo

    Pokrenite Ollama u terminalu: ollama serve

    Instalirajte željeni model, na primjer Mistral: ollama pull mistral

    Možete provjeriti instalirane modele s naredbom: ollama list


Korištenje PandasAI s Ollama u Python skripti


    U Python skripti (npr. note.ipynb) uvezite potrebne klase:


    from langchain_community.llms import Ollama 

    from pandasai import SmartDataframe 

    import pandas as pd


    Inicijalizirajte model Ollama: llm = Ollama() 


    Učitajte podatke pomoću pandas: data = pd.read_csv("putanja_do_datoteke.csv") 


    Pretvorite podatke u SmartDataframe: df = SmartDataframe(data, config={"llm": llm}) 

    Sada možete koristiti df.chat() metodu za interakciju s podacima pomoću PandasAI i Ollama 



requirements.txt

pandasai

langchain

langchain_community

ollama

streamlit

Kreirajte note.ipynb

import pandas as pd

data = pd.read_csv("vašipodaci.csv")

data.head()

from langchain_community.llms import Ollama

llm = Ollama(model="mistral")

from pandasai import SmartDataframe

df = SmartDataframe(data, config={"llm": llm})

df.chat('Postavite pitanje ovdje')

Goran Peremin

With over 10 years of experience in the field, Goran has worked on a wide range of projects, including performance marketing for eCommerce, SEO, design thinking, UX design, graphic design, social media management, and influencer marketing. It’s safe to say that Goran is a master of many skills, each more refined than the last.


Goran holds great responsibility in shaping and executing all kinds of digital marketing strategies.

 From the high peaks of content marketing to the deep caves of SEO, PPC, email, and social media, he navigates them all. He leads Bima’s digital presence, always vigilant in measuring and reporting on the performance of all digital marketing campaigns. Indeed, he ensures they achieve their goals, both ROI and KPI, lest he incur the wrath of the marketing gods.

Goran, a Growth Marketer with a keen eye for trends and insights, tirelessly optimizes his costs and performance based on such findings.

He is a true brainstorming wizard, effortlessly conjuring up new and creative growth strategies, boldly running experiments and conversion tests to uncover the most effective paths to digital marketing success.


LinkedInGitHub