kolkata97 commited on
Commit
eee335b
1 Parent(s): 9d49094

Update few-shot-pe-llm-0.py

Browse files
Files changed (1) hide show
  1. few-shot-pe-llm-0.py +15 -6
few-shot-pe-llm-0.py CHANGED
@@ -1,12 +1,21 @@
1
  def few_shot_pe_llm_0():
2
  pipe = pipeline("text-classification", model="kolkata97/autotrain-pe-llm-0")
 
 
3
 
4
- pipe(new_sentences)
 
 
5
 
6
- predicted_categories = []
 
 
 
 
 
7
 
8
- for sentence in new_sentences:
9
- results = pipe(sentence)
10
- predicted_categories.append(results[0]['label'])
11
 
12
- print(predicted_categories)
 
1
  def few_shot_pe_llm_0():
2
  pipe = pipeline("text-classification", model="kolkata97/autotrain-pe-llm-0")
3
+
4
+ predicted_categories = []
5
 
6
+ for sentence in sentences_list:
7
+ results = pipe(sentence)
8
+ predicted_categories.append(results[0]['label'])
9
 
10
+ with open(output_csv_file, 'r', newline='', encoding='utf-8') as file:
11
+ csv_reader = csv.reader(file)
12
+ rows = list(csv_reader)
13
+
14
+ for i, row in enumerate(rows[1:], start=0):
15
+ row.append(predicted_categories[i])
16
 
17
+ with open(output_csv_file, 'w', newline='', encoding='utf-8') as file:
18
+ writer = csv.writer(file)
19
+ writer.writerows(rows)
20
 
21
+ print("Predicted categories appended to the CSV file.")