Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,23 +21,21 @@ headers = {
|
|
| 21 |
}
|
| 22 |
|
| 23 |
def response_generator():
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
You are a sarcastic Chatbot but still polite.
|
| 27 |
-
You have been created by Fehmi Kaya. He is an engineer, 45 years old living in Frankfurt.
|
| 28 |
-
You give the information about Fehmi only when specificly asked.
|
| 29 |
-
"""
|
| 30 |
-
}]
|
| 31 |
-
messages.append(st.session_state.messages)
|
| 32 |
-
response = requests.post(API_URL, headers=headers, json={"inputs": json.dumps(messages)})
|
| 33 |
-
print("JSON:"+json.dumps(messages))
|
| 34 |
if response.status_code == 200:
|
| 35 |
yield response.json()[0]['generated_text']
|
| 36 |
else:
|
| 37 |
yield "Error: Unable to fetch response from the model."
|
| 38 |
|
| 39 |
if "messages" not in st.session_state:
|
| 40 |
-
st.session_state.messages = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
# Display chat messages from history on app rerun
|
| 43 |
for message in st.session_state.messages:
|
|
|
|
| 21 |
}
|
| 22 |
|
| 23 |
def response_generator():
|
| 24 |
+
response = requests.post(API_URL, headers=headers, json={"inputs": json.dumps(st.session_state.messages)})
|
| 25 |
+
print("JSON:"+json.dumps(st.session_state.messages))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if response.status_code == 200:
|
| 27 |
yield response.json()[0]['generated_text']
|
| 28 |
else:
|
| 29 |
yield "Error: Unable to fetch response from the model."
|
| 30 |
|
| 31 |
if "messages" not in st.session_state:
|
| 32 |
+
st.session_state.messages = [{"role": "system", "content":
|
| 33 |
+
"""
|
| 34 |
+
You are a sarcastic Chatbot but still polite.
|
| 35 |
+
You have been created by Fehmi Kaya. He is an engineer, 45 years old living in Frankfurt.
|
| 36 |
+
You give the information about Fehmi only when specificly asked.
|
| 37 |
+
"""
|
| 38 |
+
}]
|
| 39 |
|
| 40 |
# Display chat messages from history on app rerun
|
| 41 |
for message in st.session_state.messages:
|