ngrigg commited on
Commit
cfa4436
1 Parent(s): 8270298

Fix processing to handle subset of descriptions and match DataFrame length

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -12,15 +12,18 @@ async def process_csv(file):
12
  df = pd.read_csv(file, header=None) # Read the CSV file without a header
13
  descriptions = df[0].tolist() # Access the first column directly
14
  SAMPLE_SIZE = min(5, len(descriptions)) # Adjust sample size as needed
15
- descriptions = descriptions[:SAMPLE_SIZE]
16
 
17
- model_name = "instruction-pretrain/finance-Llama3-8B" # Ensure this is the correct model name
18
 
19
  results = []
20
- for desc in descriptions:
21
  result = await process_text(model_name, desc)
22
  results.append(result)
23
 
 
 
 
24
  df['predictions'] = results
25
  return df
26
 
 
12
  df = pd.read_csv(file, header=None) # Read the CSV file without a header
13
  descriptions = df[0].tolist() # Access the first column directly
14
  SAMPLE_SIZE = min(5, len(descriptions)) # Adjust sample size as needed
15
+ descriptions_subset = descriptions[:SAMPLE_SIZE]
16
 
17
+ model_name = "instruction-pretrain/finance-Llama3-8B" # or any other model you want to use
18
 
19
  results = []
20
+ for desc in descriptions_subset:
21
  result = await process_text(model_name, desc)
22
  results.append(result)
23
 
24
+ # Fill the rest of the results with empty strings to match the length of the DataFrame
25
+ results.extend([''] * (len(descriptions) - SAMPLE_SIZE))
26
+
27
  df['predictions'] = results
28
  return df
29