Ujeshhh commited on
Commit
1a6a3e5
·
verified ·
1 Parent(s): 31fc41c

Delete analysis.py

Browse files
Files changed (1) hide show
  1. analysis.py +0 -32
analysis.py DELETED
@@ -1,32 +0,0 @@
1
- from transformers import AutoModelForCausalLM, AutoTokenizer
2
- import torch
3
- import os
4
-
5
- HF_TOKEN = os.getenv("HF_TOKEN")
6
- MODEL_NAME = "TheBloke/Mistral-7B-Instruct-v0.1-GGUF" # Use a smaller model
7
-
8
- # Load tokenizer
9
- from transformers import AutoTokenizer
10
-
11
- # Load tokenizer from the official Mistral model
12
- tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct")
13
-
14
- # Load model (use torch.float16 if on GPU, otherwise use torch.float32 for CPU)
15
- model = AutoModelForCausalLM.from_pretrained(
16
- MODEL_NAME,
17
- torch_dtype=torch.float32, # Change to float16 if running on GPU
18
- device_map="auto", # Uses CPU if no GPU is available
19
- token=HF_TOKEN
20
- )
21
- # ✅ Create LLM Pipeline
22
- llm_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device_map="auto")
23
-
24
- def analyze_spending_pattern(df):
25
- prompt = "Analyze the following UPI transactions:\n" + df.to_string()
26
- response = llm_pipeline(prompt, max_length=200)[0]["generated_text"]
27
- return response
28
-
29
- def get_financial_advice(df):
30
- prompt = "Provide financial advice based on these UPI transactions:\n" + df.to_string()
31
- response = llm_pipeline(prompt, max_length=200)[0]["generated_text"]
32
- return response