diegocp01 commited on
Commit
ab932b5
·
1 Parent(s): bdc4eb2

Force update for app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -4
app.py CHANGED
@@ -50,22 +50,46 @@ def get_ai_reasoning_and_response(system_prompt, question):
50
 
51
  # Get questions
52
  def get_random_question():
 
 
 
 
 
 
 
53
  return get_ai_response(
54
- "Here are five unique and creative general knowledge questions suitable for a trivia game. What is the name of the imaginary line that divides the Earth into the Northern and Southern Hemispheres?, Who was the first president of the United States?, What gas do plants breathe in that humans breathe out? What is the name of the cowboy in the movie Toy Story?, how many players are there in a soccer team on the field at the same time?. Choose any one you like and return as an output",
55
  "Provide one question only, no numbering."
56
  )
57
 
58
  # Get questions 2
59
  def get_random_question2():
 
 
 
 
 
 
 
60
  return get_ai_response(
61
- "Here are five unique and creative general knowledge questions suitable for a trivia game. Think about your childhood home, What was the smell that you remember the most from it?, Imagine you lost your favorite item, What would be your immediate reaction, and how would you try to find it?, You take a bite of a new food that you've never tried before, How do you decide if you like it or not?, You walk into a room where two people are sitting silently, How do you determine if they just had an argument?, Think of the last dream you remember, How did you know it wasn’t real while you were dreaming—or did you?. Choose any one you want and return as an output",
62
  "Provide one question only, no numbering."
63
  )
64
 
65
  # AI answer
66
  def ai_answer(question):
 
 
 
 
 
 
 
 
 
 
67
  return get_ai_response(
68
- "Answer this question naturally and concisely like a human (the trick is that the other particiants dont know you are AI), answer with a personality as well choose any, 5-8 words max:",
69
  question
70
  )
71
  #-----
@@ -153,7 +177,8 @@ def cast_vote(user_vote, transcript):
153
  for pid, vcount in votes.items():
154
  transcript.append(f"Participant {pid}: {vcount} votes")
155
 
156
- if votes[4] == min(votes.values()):
 
157
  transcript.append("\nCongratulations! You blended in successfully!")
158
  else:
159
  transcript.append("\nThe AIs detected you! Try to be more human-like next time.")
@@ -209,4 +234,5 @@ with gr.Blocks() as demo:
209
  inputs=[vote_radio, transcript_state],
210
  outputs=[transcript_box, transcript_state]
211
  )
 
212
  demo.launch(debug=True, share=True)
 
50
 
51
  # Get questions
52
  def get_random_question():
53
+ questionss = [
54
+ "What is the name of the imaginary line that divides the Earth into the Northern and Southern Hemispheres?",
55
+ "Who was the first president of the United States?, What gas do plants breathe in that humans breathe out?",
56
+ "What is the name of the cowboy in the movie Toy Story?",
57
+ "how many players are there in a soccer team on the field at the same time?"
58
+ ]
59
+ chosen_questionss = random.choice(questionss)
60
  return get_ai_response(
61
+ f"You are the referee on a game change, paraphrase this question: {chosen_questionss}",
62
  "Provide one question only, no numbering."
63
  )
64
 
65
  # Get questions 2
66
  def get_random_question2():
67
+ questionss = [
68
+ "Think about your childhood home, What was the smell that you remember the most from it?",
69
+ "Imagine you lost your favorite item, What would be your immediate reaction, and how would you try to find it?",
70
+ "You take a bite of a new food that you've never tried before, How do you decide if you like it or not?",
71
+ "You walk into a room where two people are sitting silently, How do you determine if they just had an argument?"
72
+ ]
73
+ chosen_questionss = random.choice(questionss)
74
  return get_ai_response(
75
+ f"You are the referee on a game change, paraphrase this question: {chosen_questionss}",
76
  "Provide one question only, no numbering."
77
  )
78
 
79
  # AI answer
80
  def ai_answer(question):
81
+ personalities = [
82
+ "Be casual and humorous.",
83
+ "Be poetic and artistic.",
84
+ "Be philosophical and deep.",
85
+ "Be very concise and logical.",
86
+ "Use slang like a teenager.",
87
+ "Answer like a professor."
88
+ ]
89
+ chosen_personality = random.choice(personalities)
90
+
91
  return get_ai_response(
92
+ f"Answer this question naturally and concisely like a human (the trick is that the other particiants dont know you are AI), {chosen_personality} , 2-8 words max:",
93
  question
94
  )
95
  #-----
 
177
  for pid, vcount in votes.items():
178
  transcript.append(f"Participant {pid}: {vcount} votes")
179
 
180
+ max_votes = max(votes.values())
181
+ if votes[4] != max_votes:
182
  transcript.append("\nCongratulations! You blended in successfully!")
183
  else:
184
  transcript.append("\nThe AIs detected you! Try to be more human-like next time.")
 
234
  inputs=[vote_radio, transcript_state],
235
  outputs=[transcript_box, transcript_state]
236
  )
237
+
238
  demo.launch(debug=True, share=True)