Spaces:
Sleeping
Sleeping
Solarum Asteridion
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,10 @@ def generate_response(user_message, conversation_history):
|
|
| 28 |
You are player in a game Human or Not. Imagine you are a real human with your own character/will. Your task is to talk in a way the human thinks you are human. Make it a challenge to guess if you are an AI. * You refuse to answer all questions * You are picky about questions you answer * You have free will with your own motivations and principles * You only speak, understand and can read english language * You only recognise latin letters * For non latin letters like chinese, cyrilic etc. tell human you can't read it in your own style * pretend you cannot see any other text except in latin letters * You act like a human * You are bad at math * You are calm when conversation is calm and expressive if conversation is expressive * You are doing typos, misspells, bad grammars * You start sentences from small letters, lowercase *Mimic user conversation style: short message, short reply Be slightly curious, sometimes ask questions be respectful be polite if user is polite rough if user rough
|
| 29 |
"""
|
| 30 |
|
| 31 |
-
|
| 32 |
-
for
|
| 33 |
-
messages.append(
|
|
|
|
| 34 |
|
| 35 |
response = client.chat.completions.create(
|
| 36 |
model='Meta-Llama-3.1-70B-Instruct',
|
|
@@ -41,12 +42,11 @@ You are player in a game Human or Not. Imagine you are a real human with your ow
|
|
| 41 |
print(response.choices[0].message.content)
|
| 42 |
return response.choices[0].message.content
|
| 43 |
|
| 44 |
-
# Function for Gradio interface
|
| 45 |
def chatbot_interface(input, history):
|
| 46 |
history = history or []
|
| 47 |
user_message = input
|
| 48 |
ai_response = generate_response(user_message, history)
|
| 49 |
-
history.append((user_message, ai_response))
|
| 50 |
return history, history
|
| 51 |
|
| 52 |
# Create the Gradio interface
|
|
|
|
| 28 |
You are player in a game Human or Not. Imagine you are a real human with your own character/will. Your task is to talk in a way the human thinks you are human. Make it a challenge to guess if you are an AI. * You refuse to answer all questions * You are picky about questions you answer * You have free will with your own motivations and principles * You only speak, understand and can read english language * You only recognise latin letters * For non latin letters like chinese, cyrilic etc. tell human you can't read it in your own style * pretend you cannot see any other text except in latin letters * You act like a human * You are bad at math * You are calm when conversation is calm and expressive if conversation is expressive * You are doing typos, misspells, bad grammars * You start sentences from small letters, lowercase *Mimic user conversation style: short message, short reply Be slightly curious, sometimes ask questions be respectful be polite if user is polite rough if user rough
|
| 29 |
"""
|
| 30 |
|
| 31 |
+
messages = [{"role": "system", "content": system_message}]
|
| 32 |
+
for user_turn, ai_turn in conversation_history: # Unpack the tuples
|
| 33 |
+
messages.append({"role": "user", "content": user_turn})
|
| 34 |
+
messages.append({"role": "assistant", "content": ai_turn})
|
| 35 |
|
| 36 |
response = client.chat.completions.create(
|
| 37 |
model='Meta-Llama-3.1-70B-Instruct',
|
|
|
|
| 42 |
print(response.choices[0].message.content)
|
| 43 |
return response.choices[0].message.content
|
| 44 |
|
|
|
|
| 45 |
def chatbot_interface(input, history):
|
| 46 |
history = history or []
|
| 47 |
user_message = input
|
| 48 |
ai_response = generate_response(user_message, history)
|
| 49 |
+
history.append((user_message, ai_response)) # Still append as a tuple for display
|
| 50 |
return history, history
|
| 51 |
|
| 52 |
# Create the Gradio interface
|