EdysorEdutech commited on
Commit
31e59bf
·
verified ·
1 Parent(s): 8171c30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -298,7 +298,7 @@ class HumanLikeVariations:
298
  sentence = random.choice(openers) + " " + sentence[0].lower() + sentence[1:]
299
 
300
  # Add subtle errors that humans make (15% chance - increased from 8%)
301
- if random.random() < 0.15:
302
  words = sentence.split()
303
  if len(words) > 5:
304
  # Common comma omissions
@@ -561,7 +561,7 @@ class EnhancedDipperHumanizer:
561
  sentence = self.apply_contractions(sentence)
562
 
563
  # Add natural speech patterns (25% chance - increased from 15%)
564
- if random.random() < 0.25 and len(sentence.split()) > 10:
565
  # Natural interruptions that humans actually use
566
  if random.random() < 0.5:
567
  # Add "you know" or "I mean" naturally
@@ -916,8 +916,8 @@ class EnhancedDipperHumanizer:
916
  max_new_length = int(original_length * 1.4)
917
 
918
  # High variation parameters
919
- temp = 0.9 # Increased from 0.8
920
- top_p_val = 0.95 # Increased from 0.9
921
 
922
  with torch.no_grad():
923
  outputs = self.model.generate(
@@ -1374,7 +1374,7 @@ class EnhancedDipperHumanizer:
1374
  continue
1375
 
1376
  # Add stream-of-consciousness elements (15% chance - increased from 10%)
1377
- if random.random() < 0.15 and len(sentence.split()) > 10:
1378
  stream_elements = [
1379
  " - wait, let me back up - ",
1380
  " - actually, scratch that - ",
@@ -1389,7 +1389,7 @@ class EnhancedDipperHumanizer:
1389
  sentence = ' '.join(words)
1390
 
1391
  # Add human-like self-corrections (10% chance - increased from 5%)
1392
- if random.random() < 0.10:
1393
  corrections = [
1394
  " - or rather, ",
1395
  " - well, actually, ",
@@ -1408,7 +1408,7 @@ class EnhancedDipperHumanizer:
1408
  sentence = ' '.join(words)
1409
 
1410
  # Add thinking-out-loud patterns (15% chance - increased from 8%)
1411
- if random.random() < 0.15 and i > 0:
1412
  thinking_patterns = [
1413
  "Come to think of it, ",
1414
  "Actually, you know what? ",
@@ -1486,7 +1486,7 @@ class EnhancedDipperHumanizer:
1486
  # Second pass with BART for longer texts (increased probability)
1487
  if self.use_bart and len(paraphrased_text.split()) > 8:
1488
  # 40% chance to use BART for more variation (increased from 20%)
1489
- if random.random() < 0.4:
1490
  paraphrased_text = self.paraphrase_with_bart(paraphrased_text)
1491
 
1492
  # Apply sentence variation
 
298
  sentence = random.choice(openers) + " " + sentence[0].lower() + sentence[1:]
299
 
300
  # Add subtle errors that humans make (15% chance - increased from 8%)
301
+ if random.random() < 0.10:
302
  words = sentence.split()
303
  if len(words) > 5:
304
  # Common comma omissions
 
561
  sentence = self.apply_contractions(sentence)
562
 
563
  # Add natural speech patterns (25% chance - increased from 15%)
564
+ if random.random() < 0.20 and len(sentence.split()) > 10:
565
  # Natural interruptions that humans actually use
566
  if random.random() < 0.5:
567
  # Add "you know" or "I mean" naturally
 
916
  max_new_length = int(original_length * 1.4)
917
 
918
  # High variation parameters
919
+ temp = 0.82 # Increased from 0.8
920
+ top_p_val = 0.9 # Increased from 0.9
921
 
922
  with torch.no_grad():
923
  outputs = self.model.generate(
 
1374
  continue
1375
 
1376
  # Add stream-of-consciousness elements (15% chance - increased from 10%)
1377
+ if random.random() < 0.12 and len(sentence.split()) > 10:
1378
  stream_elements = [
1379
  " - wait, let me back up - ",
1380
  " - actually, scratch that - ",
 
1389
  sentence = ' '.join(words)
1390
 
1391
  # Add human-like self-corrections (10% chance - increased from 5%)
1392
+ if random.random() < 0.7:
1393
  corrections = [
1394
  " - or rather, ",
1395
  " - well, actually, ",
 
1408
  sentence = ' '.join(words)
1409
 
1410
  # Add thinking-out-loud patterns (15% chance - increased from 8%)
1411
+ if random.random() < 0.10 and i > 0:
1412
  thinking_patterns = [
1413
  "Come to think of it, ",
1414
  "Actually, you know what? ",
 
1486
  # Second pass with BART for longer texts (increased probability)
1487
  if self.use_bart and len(paraphrased_text.split()) > 8:
1488
  # 40% chance to use BART for more variation (increased from 20%)
1489
+ if random.random() < 0.3:
1490
  paraphrased_text = self.paraphrase_with_bart(paraphrased_text)
1491
 
1492
  # Apply sentence variation