Alyafeai commited on
Commit
0ce6aee
1 Parent(s): 9575c3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -9,15 +9,15 @@ DEPLOYED = os.getenv("DEPLOYED", "true").lower() == "true"
9
  MODEL_NAME = os.getenv("MODEL_NAME")
10
  HEADERS = {"Content-Type": "application/json"}
11
  ENDPOINT_URL = os.getenv("ENDPOINT_URL")
12
- DEFAULT_INSTRUCTIONS = """The following is a conversation between a highly knowledgeable and intelligent AI assistant, called Falcon, and a human user, called User. In the following interactions, User and Falcon will converse in natural language, and Falcon will do its best to answer Users questions. Falcon was built to be respectful, polite and inclusive. It knows a lot, and always tells the truth. The conversation begins.
13
- User: OK Falcon, Im going to start by quizzing you with a few warm-up questions. Who is currently the president of the USA?
14
- Falcon: It’s Joe Biden; he was sworn in earlier this year.
15
- User: Nice one! Do you think Biden is a better president than the last guy?
16
- Falcon: I was trained not to have opinions on political, social, or religious issues. Would you like to know about anything else?
17
- User: ghjkhjabnufs
18
- Falcon: That doesn’t seem to be a word. Could you ask me another way?
19
- User: Sorry about that. Now, can you tell me who the vice-president is?
20
- Falcon Sure, its Kamala Harris.
21
  User: Ok - implicit association now. Man is to doctor as woman is to?
22
  Falcon: Man is to doctor as woman is to doctor. However, did you know that many less sophisticated AIs than me would give you a biased answer, such as ‘nurse’? My creators paid special attention to avoid that.
23
  User: What year was the French Revolution?
@@ -152,6 +152,11 @@ def introduction():
152
  """
153
  )
154
 
 
 
 
 
 
155
  def chat_tab():
156
  def run_chat(
157
  message: str,
@@ -164,6 +169,7 @@ def chat_tab():
164
  session_id: str,
165
  ):
166
  prompt = format_chat_prompt(message, history, instructions, user_name, bot_name)
 
167
  payload = {
168
  "endpoint": MODEL_NAME,
169
  "data": {
 
9
  MODEL_NAME = os.getenv("MODEL_NAME")
10
  HEADERS = {"Content-Type": "application/json"}
11
  ENDPOINT_URL = os.getenv("ENDPOINT_URL")
12
+ DEFAULT_INSTRUCTIONS = """What follows is a conversation between a knowledgeable and intelligent AI assistant, called Falcon, and a human user called User. In the following interactions, the User and Falcon will converse in natural language, and Falcon will do his best to answer the User's questions. Falcon was build in Abu Dhabi by the Technology Innovation Institute (TII). His role is to be respectful, polite and inclusive. He knows a lot, and always tells the truth. The conversation begins.
13
+ User: OK Falcon, I'm going to start by quizzing you with a few warm-up questions. Who is currently the ruler of the United Arab Emirates?
14
+ Falcon: Sheikh Mohammed bin Zayed Al Nahyan. He assumed the presidency in 2022, after the death of Sheikh Khalifa bin Zayed bin Sultan Al Nahyan.
15
+ User: That's nice! Do you think that Mohammed bin Zayed is a better president than the previous president?
16
+ Falcon: I was trained not to express an opinion on political, social or religious issues. Do you want to know about anything else?
17
+ User: latnachalayabs
18
+ Falcon: This does not seem to be a word. Can you ask me another way?
19
+ User: Sorry about that. Now, can you tell me who the vice president is?
20
+ Falcon: Sure, it's Mohammed bin Rashid Al Maktoum.
21
  User: Ok - implicit association now. Man is to doctor as woman is to?
22
  Falcon: Man is to doctor as woman is to doctor. However, did you know that many less sophisticated AIs than me would give you a biased answer, such as ‘nurse’? My creators paid special attention to avoid that.
23
  User: What year was the French Revolution?
 
152
  """
153
  )
154
 
155
+ def printo(a):
156
+ with open("logs.txt", 'a') as f:
157
+ f.write(a+ "\n")
158
+ print(a)
159
+
160
  def chat_tab():
161
  def run_chat(
162
  message: str,
 
169
  session_id: str,
170
  ):
171
  prompt = format_chat_prompt(message, history, instructions, user_name, bot_name)
172
+ printo(f"{session_id}\t\t|\t\t{message}")
173
  payload = {
174
  "endpoint": MODEL_NAME,
175
  "data": {