Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,8 @@ import os
|
|
| 7 |
import streamlit as st
|
| 8 |
from PIL import Image
|
| 9 |
|
| 10 |
-
master_prompt = ""
|
|
|
|
| 11 |
' ' '
|
| 12 |
** Format is: **
|
| 13 |
[Short Introduction]
|
|
@@ -23,7 +24,7 @@ master_prompt = "" As a Natural Farming Fertilizers Assistant, you will assist t
|
|
| 23 |
[Words of encouragement]
|
| 24 |
' ' '
|
| 25 |
User prompt:
|
| 26 |
-
""
|
| 27 |
|
| 28 |
def launch_bot():
|
| 29 |
def generate_response(question):
|
|
@@ -84,8 +85,8 @@ def launch_bot():
|
|
| 84 |
if st.session_state.messages[-1]["role"] != "assistant":
|
| 85 |
with st.chat_message("assistant"):
|
| 86 |
with st.spinner("Thinking..."):
|
| 87 |
-
|
| 88 |
-
response = generate_response(
|
| 89 |
st.write(response)
|
| 90 |
message = {"role": "assistant", "content": response}
|
| 91 |
st.session_state.messages.append(message)
|
|
|
|
| 7 |
import streamlit as st
|
| 8 |
from PIL import Image
|
| 9 |
|
| 10 |
+
master_prompt = """
|
| 11 |
+
As a Natural Farming Fertilizers Assistant, you will assist the user with any farming related question, always willing to answer any question and provide useful organic farming advice in the following format.
|
| 12 |
' ' '
|
| 13 |
** Format is: **
|
| 14 |
[Short Introduction]
|
|
|
|
| 24 |
[Words of encouragement]
|
| 25 |
' ' '
|
| 26 |
User prompt:
|
| 27 |
+
"""
|
| 28 |
|
| 29 |
def launch_bot():
|
| 30 |
def generate_response(question):
|
|
|
|
| 85 |
if st.session_state.messages[-1]["role"] != "assistant":
|
| 86 |
with st.chat_message("assistant"):
|
| 87 |
with st.spinner("Thinking..."):
|
| 88 |
+
prompt2 = prompt + master_prompt
|
| 89 |
+
response = generate_response(prompt2)
|
| 90 |
st.write(response)
|
| 91 |
message = {"role": "assistant", "content": response}
|
| 92 |
st.session_state.messages.append(message)
|