Spaces:
Runtime error
Runtime error
Fix path and file reading for CSV input
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ import io
|
|
| 21 |
|
| 22 |
# === [1] Model and Tokenizer Loading ===
|
| 23 |
base_model_id = "NousResearch/Nous-Hermes-2-Mistral-7B-DPO"
|
| 24 |
-
lora_path = "
|
| 25 |
|
| 26 |
# Load base model and LoRA adapter
|
| 27 |
base_model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype=torch.float16)
|
|
@@ -47,11 +47,9 @@ tokenizer = AutoTokenizer.from_pretrained(lora_path)
|
|
| 47 |
# Answer:"""
|
| 48 |
|
| 49 |
def create_prompt_from_csv(table_file, prompt_text):
|
| 50 |
-
|
| 51 |
-
df = pd.read_csv(io.BytesIO(content))
|
| 52 |
markdown_table = df.to_markdown(index=False)
|
| 53 |
|
| 54 |
-
# Return combined prompt
|
| 55 |
return f"""You are a financial assistant. Given the table and prompt, answer accordingly.
|
| 56 |
|
| 57 |
Table:
|
|
|
|
| 21 |
|
| 22 |
# === [1] Model and Tokenizer Loading ===
|
| 23 |
base_model_id = "NousResearch/Nous-Hermes-2-Mistral-7B-DPO"
|
| 24 |
+
lora_path = "tat-llm-final-e3"
|
| 25 |
|
| 26 |
# Load base model and LoRA adapter
|
| 27 |
base_model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype=torch.float16)
|
|
|
|
| 47 |
# Answer:"""
|
| 48 |
|
| 49 |
def create_prompt_from_csv(table_file, prompt_text):
|
| 50 |
+
df = pd.read_csv(table_file.name)
|
|
|
|
| 51 |
markdown_table = df.to_markdown(index=False)
|
| 52 |
|
|
|
|
| 53 |
return f"""You are a financial assistant. Given the table and prompt, answer accordingly.
|
| 54 |
|
| 55 |
Table:
|