Update app.py
Browse files
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 |
-
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"
|
| 18 |
-
"
|
| 19 |
-
"
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"If you could wake up tomorrow having gained any one quality or ability, what would it be?"
|
| 26 |
]
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
"What is your
|
| 35 |
-
"
|
| 36 |
-
"What
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
-
"
|
| 40 |
-
"
|
| 41 |
]
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
"
|
| 45 |
-
"
|
| 46 |
-
"
|
| 47 |
-
"
|
| 48 |
-
"
|
| 49 |
-
"
|
| 50 |
-
"
|
| 51 |
-
"
|
| 52 |
-
"
|
| 53 |
-
"
|
| 54 |
-
"
|
| 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(
|
| 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", "
|
| 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()
|
|
|