Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -547,7 +547,7 @@ def categorize_responses(df, api_key, prompt=None):
|
|
547 |
Categorize responses in a DataFrame using OpenAI's GPT-based API.
|
548 |
|
549 |
Args:
|
550 |
-
df (pd.DataFrame): Input DataFrame with columns 'id' and '
|
551 |
api_key (str): OpenAI API key for accessing GPT-based models.
|
552 |
prompt (str, optional): A question or explanation of the survey question for better categorization.
|
553 |
|
@@ -566,7 +566,7 @@ def categorize_responses(df, api_key, prompt=None):
|
|
566 |
categories = []
|
567 |
|
568 |
# Iterate through the responses in the DataFrame
|
569 |
-
for response in df
|
570 |
# Construct the prompt for the specific response
|
571 |
full_prompt = f"{base_prompt}\n\nResponse: {response}\n\nCategory:"
|
572 |
|
|
|
547 |
Categorize responses in a DataFrame using OpenAI's GPT-based API.
|
548 |
|
549 |
Args:
|
550 |
+
df (pd.DataFrame): Input DataFrame with columns 'id' and 'p1'.
|
551 |
api_key (str): OpenAI API key for accessing GPT-based models.
|
552 |
prompt (str, optional): A question or explanation of the survey question for better categorization.
|
553 |
|
|
|
566 |
categories = []
|
567 |
|
568 |
# Iterate through the responses in the DataFrame
|
569 |
+
for response in df['p1']:
|
570 |
# Construct the prompt for the specific response
|
571 |
full_prompt = f"{base_prompt}\n\nResponse: {response}\n\nCategory:"
|
572 |
|