simondh commited on
Commit
1e42e03
·
1 Parent(s): dc38c9a

change temperature to 0

Browse files
Files changed (2) hide show
  1. app.py +8 -8
  2. prompts.py +1 -1
app.py CHANGED
@@ -267,7 +267,7 @@ with gr.Blocks(title="Text Classification System") as demo:
267
  ("TF-IDF + LLM (Hybride, >1000 lignes)", "hybrid")
268
  ],
269
  label="Modèle de classification",
270
- value="tfidf",
271
  visible=False
272
  )
273
  show_explanations = gr.Checkbox(label="Show Explanations", value=True, visible=False)
@@ -324,7 +324,7 @@ with gr.Blocks(title="Text Classification System") as demo:
324
  response = client.chat.completions.create(
325
  model="gpt-3.5-turbo",
326
  messages=[{"role": "user", "content": prompt}],
327
- temperature=0.2,
328
  max_tokens=100
329
  )
330
  suggested_cats = [cat.strip() for cat in response.choices[0].message.content.strip().split(",")]
@@ -388,13 +388,13 @@ with gr.Blocks(title="Text Classification System") as demo:
388
  if client:
389
  prompt = ADDITIONAL_CATEGORY_PROMPT.format(
390
  existing_categories=", ".join(current_categories),
391
- sample_texts="\n---\n".join(sample_texts[:5])
392
  )
393
  try:
394
  response = client.chat.completions.create(
395
  model="gpt-3.5-turbo",
396
  messages=[{"role": "user", "content": prompt}],
397
- temperature=0.2,
398
  max_tokens=50
399
  )
400
  new_cat = response.choices[0].message.content.strip()
@@ -431,7 +431,7 @@ with gr.Blocks(title="Text Classification System") as demo:
431
  response = client.chat.completions.create(
432
  model="gpt-4",
433
  messages=[{"role": "user", "content": prompt}],
434
- temperature=0.2,
435
  max_tokens=300
436
  )
437
  improvements = json.loads(response.choices[0].message.content.strip())
@@ -448,18 +448,18 @@ with gr.Blocks(title="Text Classification System") as demo:
448
  temp_df = load_data(file)
449
  else:
450
  temp_df = load_data(file.name)
451
- sample_texts.extend(temp_df[col].head(5).tolist())
452
 
453
  category_prompt = CATEGORY_IMPROVEMENT_PROMPT.format(
454
  current_categories=", ".join(current_categories),
455
  analysis=improvements.get('analysis', ''),
456
- sample_texts="\n---\n".join(sample_texts[:5])
457
  )
458
 
459
  category_response = client.chat.completions.create(
460
  model="gpt-4",
461
  messages=[{"role": "user", "content": category_prompt}],
462
- temperature=0.2,
463
  max_tokens=100
464
  )
465
 
 
267
  ("TF-IDF + LLM (Hybride, >1000 lignes)", "hybrid")
268
  ],
269
  label="Modèle de classification",
270
+ value="gpt35",
271
  visible=False
272
  )
273
  show_explanations = gr.Checkbox(label="Show Explanations", value=True, visible=False)
 
324
  response = client.chat.completions.create(
325
  model="gpt-3.5-turbo",
326
  messages=[{"role": "user", "content": prompt}],
327
+ temperature=0,
328
  max_tokens=100
329
  )
330
  suggested_cats = [cat.strip() for cat in response.choices[0].message.content.strip().split(",")]
 
388
  if client:
389
  prompt = ADDITIONAL_CATEGORY_PROMPT.format(
390
  existing_categories=", ".join(current_categories),
391
+ sample_texts="\n---\n".join(sample_texts[:10])
392
  )
393
  try:
394
  response = client.chat.completions.create(
395
  model="gpt-3.5-turbo",
396
  messages=[{"role": "user", "content": prompt}],
397
+ temperature=0,
398
  max_tokens=50
399
  )
400
  new_cat = response.choices[0].message.content.strip()
 
431
  response = client.chat.completions.create(
432
  model="gpt-4",
433
  messages=[{"role": "user", "content": prompt}],
434
+ temperature=0,
435
  max_tokens=300
436
  )
437
  improvements = json.loads(response.choices[0].message.content.strip())
 
448
  temp_df = load_data(file)
449
  else:
450
  temp_df = load_data(file.name)
451
+ sample_texts.extend(temp_df[col].head(10).tolist())
452
 
453
  category_prompt = CATEGORY_IMPROVEMENT_PROMPT.format(
454
  current_categories=", ".join(current_categories),
455
  analysis=improvements.get('analysis', ''),
456
+ sample_texts="\n---\n".join(sample_texts[:10])
457
  )
458
 
459
  category_response = client.chat.completions.create(
460
  model="gpt-4",
461
  messages=[{"role": "user", "content": category_prompt}],
462
+ temperature=0,
463
  max_tokens=100
464
  )
465
 
prompts.py CHANGED
@@ -2,7 +2,7 @@
2
 
3
  # Category suggestion prompt
4
  CATEGORY_SUGGESTION_PROMPT = """
5
- Based on these example texts, suggest 5 appropriate categories for classification:
6
 
7
  {}
8
 
 
2
 
3
  # Category suggestion prompt
4
  CATEGORY_SUGGESTION_PROMPT = """
5
+ Based on these example texts, suggest between 3 and 5 appropriate categories for classification:
6
 
7
  {}
8