Wanswan commited on
Commit
46fb6bc
·
verified ·
1 Parent(s): 0967da6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -46
app.py CHANGED
@@ -9,54 +9,52 @@ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
9
  DEFAULT_LANGUAGE = "English"
10
  WELCOME_MESSAGE_EN = "Hi! I'm your friendly assistant 🤖 Let's begin!\n\nPlease tell me which language you'd like to use."
11
 
12
- # === Question Bank ===
13
- SET_I = [
14
- "Given the choice of anyone in the world, whom would you want as a dinner guest?",
15
- "Would you like to be famous? In what way?",
16
- "Before making a telephone call, do you ever rehearse what you are going to say? Why?",
17
- "What would constitute a 'perfect' day for you?",
18
- "When did you last sing to yourself? To someone else?",
19
- "If you were able to live to the age of 90 and retain either the mind or body of a 30-year-old for the last 60 years of your life, which would you want?",
20
- "Do you have a secret hunch about how you will die?",
21
- "Name three things you and me appear to have in common.",
22
- "For what in your life do you feel most grateful?",
23
- "If you could change anything about the way you were raised, what would it be?",
24
- "Take one minutes and tell me your life story in as much detail as possible.",
25
- "If you could wake up tomorrow having gained any one quality or ability, what would it be?"
26
  ]
27
-
28
- SET_II = [
29
- "If a crystal ball could tell you the truth about yourself, your life, the future or anything else, what would you want to know?",
30
- "Is there something that you’ve dreamed of doing for a long time? Why haven’t you done it?",
31
- "What is the greatest accomplishment of your life?",
32
- "What do you value most in a friendship?",
33
- "What is your most treasured memory?",
34
- "What is your most terrible memory?",
35
- "If you knew that in one year you would die suddenly, would you change anything about the way you are now living? Why?",
36
- "What does friendship mean to you?",
37
- "What roles do love and affection play in your life?",
38
- "Alternate sharing something you consider a positive characteristic of me. Share a total of three items.",
39
- "How close and warm is your family? Do you feel your childhood was happier than most other people’s?",
40
- "How do you feel about your relationship with your mother?"
41
  ]
42
-
43
- SET_III = [
44
- "Make three true 'we' statements each. For instance, 'We are both in this chatroom feeling ...'",
45
- "Complete this sentence: 'I wish I had someone with whom I could share ...'",
46
- "If you were going to become a close friend with me, please share what would be important for me to know.",
47
- "Tell me what you like about me; be very honest this time, saying things that you might not say to someone you’ve just met.",
48
- "Share with me an embarrassing moment in your life.",
49
- "When did you last cry in front of another person? By yourself?",
50
- "Tell me something that you like about me already.",
51
- "What, if anything, is too serious to be joked about?",
52
- "If you were to die this evening with no opportunity to communicate with anyone, what would you most regret not having told someone? Why haven’t you told them yet?",
53
- "Your house, containing everything you own, catches fire. After saving your loved ones and pets, you have time to safely make a final dash to save any one item. What would it be? Why?",
54
- "Of all the people in your family, whose death would you find most disturbing? Why?",
55
- "Share a personal problem and ask my advice on how I might handle it. Also, ask me to reflect back to you how you seem to be feeling about the problem you have chosen."
56
  ]
57
 
58
  def generate_question_set():
59
- return random.sample(SET_I, 3) + random.sample(SET_II, 3) + random.sample(SET_III, 3)
60
 
61
  async def gpt_translate(text, target_lang):
62
  if target_lang == "English":
@@ -187,7 +185,6 @@ with gr.Blocks(css="""
187
  }
188
  #chatbox .message.user { background-color: #DCF8C6 !important; }
189
  #chatbox .message.assistant { background-color: #ffffff !important; }
190
-
191
  """) as demo:
192
  gr.HTML("""
193
  <script>
@@ -209,7 +206,7 @@ with gr.Blocks(css="""
209
  chatbot = gr.Chatbot(
210
  elem_id="chatbox",
211
  label="",
212
- avatar_images=["user_avatar.jpg", "bot_avatar.png"],
213
  bubble_full_width=False,
214
  height=500,
215
  show_copy_button=False,
@@ -238,4 +235,3 @@ with gr.Blocks(css="""
238
  [chatbot, user_input, step, language, questions, followup_mode])
239
 
240
  demo.queue().launch()
241
-
 
9
  DEFAULT_LANGUAGE = "English"
10
  WELCOME_MESSAGE_EN = "Hi! I'm your friendly assistant 🤖 Let's begin!\n\nPlease tell me which language you'd like to use."
11
 
12
+ # === Normal Question Bank ===
13
+ NORMAL_SET_I = [
14
+ "When was the last time you walked for more than an hour? Describe where you went and what you saw.",
15
+ "What is the best gift you have ever received? Why?",
16
+ "If you had to leave California, where would you move to? What do you miss most about California?",
17
+ "How did you celebrate Halloween last year?",
18
+ "Do you read newspapers often? Which newspapers do you like? Why?",
19
+ "What is the ideal number of students to share a house with? Why?",
20
+ "If you could invent a new flavor of ice cream, what flavor would you create?",
21
+ "What is the best restaurant you have been to in the past month that your partner has not been to? Describe it to your partner.",
22
+ "Describe the pet you last got.",
23
+ "What is your favorite holiday? Why?",
24
+ "Tell your partner the funniest thing that happened when you were with a child."
 
25
  ]
26
+ NORMAL_SET_II = [
27
+ "What gift did you get on your last birthday?",
28
+ "Describe your last trip to the zoo.",
29
+ "Name and age of your family members, including grandparents, uncles and aunts, and where they were born (to the extent known).",
30
+ "One person says a word, and the next person says a word starting with the last letter of the previous word. Continue for 50 words. No need to form sentences.",
31
+ "Do you like to wake up early or stay up late? Has anything interesting ever happened to you because of this?",
32
+ "Where are you from? List all the places you have lived.",
33
+ "What is your favorite class at UC Santa Cruz? Why?",
34
+ "What did you do this summer?",
35
+ "What gifts did you receive last Christmas/Hanukkah?",
36
+ "Who is your favorite same-sex actor? Describe a great scene he or she starred in.",
37
+ "What was your impression of UC Santa Cruz when you first came to it?",
38
+ "What is the best TV show you have seen in the past month that your partner has not seen? Describe it to your partner.",
39
+ "What is your favorite holiday? Why?"
40
  ]
41
+ NORMAL_SET_III = [
42
+ "Where did you go to high school? What was it like?",
43
+ "What is the best book you have read in the past three months that your partner has not read? Describe it to your partner.",
44
+ "What country would you most like to visit? What attracts you to it?",
45
+ "Do you prefer digital or analog watches/clocks? Why?",
46
+ "Describe your mother's best friend.",
47
+ "What are the pros and cons of artificial Christmas trees?",
48
+ "How often do you get your hair cut? Where do you go? Have you ever had a bad haircut?",
49
+ "Did you have a class pet in elementary school? Do you remember its name?",
50
+ "Do you think left-handed people are more creative than right-handed people?",
51
+ "What was the last concert you attended? How many albums of the band do you have? Have you seen them perform before? Where?",
52
+ "What magazines do you subscribe to? What have you subscribed to in the past?",
53
+ "Have you ever participated in a school play? What role did you play? What was the plot? Did anything funny happen during the play?"
 
54
  ]
55
 
56
  def generate_question_set():
57
+ return random.sample(NORMAL_SET_I, 3) + random.sample(NORMAL_SET_II, 3) + random.sample(NORMAL_SET_III, 3)
58
 
59
  async def gpt_translate(text, target_lang):
60
  if target_lang == "English":
 
185
  }
186
  #chatbox .message.user { background-color: #DCF8C6 !important; }
187
  #chatbox .message.assistant { background-color: #ffffff !important; }
 
188
  """) as demo:
189
  gr.HTML("""
190
  <script>
 
206
  chatbot = gr.Chatbot(
207
  elem_id="chatbox",
208
  label="",
209
+ avatar_images=["user_avatar.jpg", "humanlike_avatar.png.png"],
210
  bubble_full_width=False,
211
  height=500,
212
  show_copy_button=False,
 
235
  [chatbot, user_input, step, language, questions, followup_mode])
236
 
237
  demo.queue().launch()