Spaces:
Sleeping
Sleeping
Delete csv_agent.py
Browse files- csv_agent.py +0 -22
csv_agent.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from huggingface_hub import InferenceClient
|
| 3 |
-
|
| 4 |
-
client = InferenceClient(
|
| 5 |
-
model="google/flan-t5-large",
|
| 6 |
-
token=os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 7 |
-
)
|
| 8 |
-
|
| 9 |
-
def generate_code(prompt):
|
| 10 |
-
full_prompt = f"""You are a Python Pandas expert.
|
| 11 |
-
Write Python Pandas code to perform the following operation on a dataframe named df:
|
| 12 |
-
{prompt}
|
| 13 |
-
Only output valid Python code, no explanation, no extra text."""
|
| 14 |
-
|
| 15 |
-
response = client.text_generation(
|
| 16 |
-
prompt=full_prompt,
|
| 17 |
-
max_new_tokens=300,
|
| 18 |
-
temperature=0.2,
|
| 19 |
-
top_p=0.9,
|
| 20 |
-
repetition_penalty=1.05
|
| 21 |
-
)
|
| 22 |
-
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|