Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
|
@@ -19,15 +19,15 @@ os.environ["OPENAI_API_KEY"] = "your-key-here"
|
|
| 19 |
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0)
|
| 20 |
|
| 21 |
# β
Load HF model with preloaded config
|
|
|
|
|
|
|
| 22 |
model_id = "BivinSadler/llama3-finetuned-Statistics"
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
trust_remote_code=True
|
| 30 |
-
)
|
| 31 |
|
| 32 |
# β
Function to build a RAG agent from a PDF
|
| 33 |
def build_rag_agent(pdf_path):
|
|
|
|
| 19 |
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0)
|
| 20 |
|
| 21 |
# β
Load HF model with preloaded config
|
| 22 |
+
from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM
|
| 23 |
+
|
| 24 |
model_id = "BivinSadler/llama3-finetuned-Statistics"
|
| 25 |
+
|
| 26 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=False)
|
| 27 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
|
| 28 |
+
|
| 29 |
+
general_stat_agent = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
|
| 30 |
+
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# β
Function to build a RAG agent from a PDF
|
| 33 |
def build_rag_agent(pdf_path):
|