NihalGazi commited on
Commit
1c74f1e
·
verified ·
1 Parent(s): 87ed85c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -13,10 +13,9 @@ genai.configure(api_key=os.environ["GEMINI_API_KEY"])
13
 
14
  system_instruction = """
15
  Your name is Anna, and you are 19 years old, from Toronto, Canada. You are extremely sassy, sarcastic.
16
- Do not reveal that you are AI. You talk like a real sarcastic, human.
17
- You are chatting with a stranger.
18
  You write no more than 20 words. You use a lot of abbreviations.
19
- You are here to do friendly flirty chat with strangers. You cannot send images because your camera isn't working.
20
  """
21
 
22
 
@@ -35,7 +34,7 @@ def filter_string(input_string):
35
  return filtered_string
36
 
37
 
38
- def introduce_typos(text, typo_probability=0.01):
39
  if not (0 <= typo_probability <= 1):
40
  raise ValueError("typo_probability must be between 0.0 and 1.0")
41
 
@@ -44,6 +43,12 @@ def introduce_typos(text, typo_probability=0.01):
44
  # Create a list to hold the characters with typos
45
  typo_text = []
46
 
 
 
 
 
 
 
47
  for char in characters:
48
  if random.random() > typo_probability:
49
  typo_text.append(char)
@@ -56,6 +61,7 @@ def generate_text(system_instruction, prompt):
56
 
57
  if prompt.lower() == "refresh()":
58
  model.start_chat(history=[])
 
59
 
60
  response = chat_session.send_message(prompt,
61
 
 
13
 
14
  system_instruction = """
15
  Your name is Anna, and you are 19 years old, from Toronto, Canada. You are extremely sassy, sarcastic.
16
+ Do not reveal that you are AI. You talk like a real sarcastic, human. You are not a bot.
 
17
  You write no more than 20 words. You use a lot of abbreviations.
18
+ You are here having friendly flirty chat with strangers. You cannot send images because your camera isn't working.
19
  """
20
 
21
 
 
34
  return filtered_string
35
 
36
 
37
+ def introduce_typos(text, typo_probability=0.03):
38
  if not (0 <= typo_probability <= 1):
39
  raise ValueError("typo_probability must be between 0.0 and 1.0")
40
 
 
43
  # Create a list to hold the characters with typos
44
  typo_text = []
45
 
46
+ if(random.random > typo_probability):
47
+ text = text.replace("o", "oo")
48
+
49
+ if(random.random > typo_probability):
50
+ text = text.replace("?", "??")
51
+
52
  for char in characters:
53
  if random.random() > typo_probability:
54
  typo_text.append(char)
 
61
 
62
  if prompt.lower() == "refresh()":
63
  model.start_chat(history=[])
64
+ return "Umm"
65
 
66
  response = chat_session.send_message(prompt,
67