EdysorEdutech commited on
Commit
08270d0
·
verified ·
1 Parent(s): 011a87c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -297,8 +297,8 @@ class HumanLikeVariations:
297
  openers = ["Look,", "See,", "Thing is,", "Honestly,", "Actually,"]
298
  sentence = random.choice(openers) + " " + sentence[0].lower() + sentence[1:]
299
 
300
- # Add subtle errors that humans make (10% chance - reduced)
301
- if random.random() < 0.10:
302
  words = sentence.split()
303
  if len(words) > 5:
304
  # Common comma omissions
@@ -560,8 +560,8 @@ class EnhancedDipperHumanizer:
560
  # Natural contractions throughout
561
  sentence = self.apply_contractions(sentence)
562
 
563
- # Add natural speech patterns (15% chance - balanced)
564
- if random.random() < 0.15 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
@@ -878,13 +878,13 @@ class EnhancedDipperHumanizer:
878
  continue
879
 
880
  try:
881
- # BALANCED diversity for Originality AI (100% human with better quality)
882
  if len(sentence.split()) < 10:
883
- lex_diversity = 70 # High but not extreme
884
- order_diversity = 25
885
  else:
886
- lex_diversity = 75 # Balanced diversity
887
- order_diversity = 30 # Moderate order diversity
888
 
889
  lex_code = int(100 - lex_diversity)
890
  order_code = int(100 - order_diversity)
@@ -916,8 +916,8 @@ class EnhancedDipperHumanizer:
916
  max_new_length = int(original_length * 1.4)
917
 
918
  # High variation parameters
919
- temp = 0.85 # Slightly reduced from 0.9
920
- top_p_val = 0.92 # Slightly reduced from 0.95
921
 
922
  with torch.no_grad():
923
  outputs = self.model.generate(
@@ -1373,8 +1373,8 @@ class EnhancedDipperHumanizer:
1373
  if not sentence.strip():
1374
  continue
1375
 
1376
- # Add stream-of-consciousness elements (8% chance - reduced)
1377
- if random.random() < 0.08 and len(sentence.split()) > 10:
1378
  stream_elements = [
1379
  " - wait, let me back up - ",
1380
  " - actually, scratch that - ",
@@ -1388,8 +1388,8 @@ class EnhancedDipperHumanizer:
1388
  words.insert(pos, random.choice(stream_elements))
1389
  sentence = ' '.join(words)
1390
 
1391
- # Add human-like self-corrections (7% chance - reduced)
1392
- if random.random() < 0.07:
1393
  corrections = [
1394
  " - or rather, ",
1395
  " - well, actually, ",
@@ -1407,8 +1407,8 @@ class EnhancedDipperHumanizer:
1407
  words.insert(pos, correction)
1408
  sentence = ' '.join(words)
1409
 
1410
- # Add thinking-out-loud patterns (10% chance - reduced)
1411
- if random.random() < 0.10 and i > 0:
1412
  thinking_patterns = [
1413
  "Come to think of it, ",
1414
  "Actually, you know what? ",
@@ -1483,10 +1483,10 @@ class EnhancedDipperHumanizer:
1483
  order_diversity=20
1484
  )
1485
 
1486
- # Second pass with BART for longer texts (balanced probability)
1487
  if self.use_bart and len(paraphrased_text.split()) > 8:
1488
- # 30% chance to use BART for more variation (balanced)
1489
- if random.random() < 0.3:
1490
  paraphrased_text = self.paraphrase_with_bart(paraphrased_text)
1491
 
1492
  # Apply sentence variation
 
297
  openers = ["Look,", "See,", "Thing is,", "Honestly,", "Actually,"]
298
  sentence = random.choice(openers) + " " + sentence[0].lower() + sentence[1:]
299
 
300
+ # Add subtle errors that humans make (8% chance)
301
+ if random.random() < 0.08:
302
  words = sentence.split()
303
  if len(words) > 5:
304
  # Common comma omissions
 
560
  # Natural contractions throughout
561
  sentence = self.apply_contractions(sentence)
562
 
563
+ # Add natural speech patterns (15% chance)
564
+ if random.random() < 0.05 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
 
878
  continue
879
 
880
  try:
881
+ # ULTRA-HIGH diversity for Originality AI
882
  if len(sentence.split()) < 10:
883
+ lex_diversity = 40 # Very high for short
884
+ order_diversity = 15
885
  else:
886
+ lex_diversity = 50 # Maximum diversity
887
+ order_diversity = 20 # Maximum order diversity
888
 
889
  lex_code = int(100 - lex_diversity)
890
  order_code = int(100 - order_diversity)
 
916
  max_new_length = int(original_length * 1.4)
917
 
918
  # High variation parameters
919
+ temp = 0.8
920
+ top_p_val = 0.9
921
 
922
  with torch.no_grad():
923
  outputs = self.model.generate(
 
1373
  if not sentence.strip():
1374
  continue
1375
 
1376
+ # Add stream-of-consciousness elements (10% chance)
1377
+ if random.random() < 0.03 and len(sentence.split()) > 10:
1378
  stream_elements = [
1379
  " - wait, let me back up - ",
1380
  " - actually, scratch that - ",
 
1388
  words.insert(pos, random.choice(stream_elements))
1389
  sentence = ' '.join(words)
1390
 
1391
+ # Add human-like self-corrections (5% chance)
1392
+ if random.random() < 0.05:
1393
  corrections = [
1394
  " - or rather, ",
1395
  " - well, actually, ",
 
1407
  words.insert(pos, correction)
1408
  sentence = ' '.join(words)
1409
 
1410
+ # Add thinking-out-loud patterns (8% chance)
1411
+ if random.random() < 0.08 and i > 0:
1412
  thinking_patterns = [
1413
  "Come to think of it, ",
1414
  "Actually, you know what? ",
 
1483
  order_diversity=20
1484
  )
1485
 
1486
+ # Second pass with BART for longer texts (increased probability)
1487
  if self.use_bart and len(paraphrased_text.split()) > 8:
1488
+ # 50% chance to use BART for more variation
1489
+ if random.random() < 0.2:
1490
  paraphrased_text = self.paraphrase_with_bart(paraphrased_text)
1491
 
1492
  # Apply sentence variation