Spaces:
Sleeping
Sleeping
N.Achyuth Reddy
commited on
Commit
Β·
cab6a89
1
Parent(s):
b151e56
Update app.py
Browse files
app.py
CHANGED
@@ -31,10 +31,6 @@ def transcribe(wav_path):
|
|
31 |
api_name="/predict"
|
32 |
)
|
33 |
|
34 |
-
# Initialize session state
|
35 |
-
if "messages" not in st.session_state:
|
36 |
-
st.session_state.messages = []
|
37 |
-
|
38 |
# Prediction function
|
39 |
def predict(message, system_prompt='Your name is OpenGPT. You are developed by Achyuth. You need to mostly focus on giving information about future agriculture and advanced farming. Empower yourself farming future with cutting-edge technology and sustainable practices. You need to cultivate a greener and more productive. Your developer is studying in The Hyderabad Public School Kadapa.', temperature=0.7, max_new_tokens=4096, Topp=0.5, Repetitionpenalty=1.2):
|
40 |
with st.status("Starting client"):
|
@@ -65,12 +61,17 @@ def text_to_speech(text, language='en', filename='output.mp3'):
|
|
65 |
st.title(TITLE)
|
66 |
st.write(DESCRIPTION)
|
67 |
|
|
|
|
|
|
|
|
|
68 |
# Display chat messages from history on app rerun
|
69 |
for message in st.session_state.messages:
|
70 |
with st.chat_message(message["role"], avatar=("π§βπ»" if message["role"] == 'human' else 'π¦')):
|
71 |
st.markdown(message["content"])
|
72 |
|
73 |
textinput = st.chat_input("Ask AgriTure anything...")
|
|
|
74 |
# Assume st_audiorec is a simplified audio recorder function
|
75 |
wav_audio_data = st.audio_recorder()
|
76 |
|
@@ -106,4 +107,4 @@ if prompt := textinput:
|
|
106 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
107 |
|
108 |
# Convert response to audio
|
109 |
-
text_to_speech(response)
|
|
|
31 |
api_name="/predict"
|
32 |
)
|
33 |
|
|
|
|
|
|
|
|
|
34 |
# Prediction function
|
35 |
def predict(message, system_prompt='Your name is OpenGPT. You are developed by Achyuth. You need to mostly focus on giving information about future agriculture and advanced farming. Empower yourself farming future with cutting-edge technology and sustainable practices. You need to cultivate a greener and more productive. Your developer is studying in The Hyderabad Public School Kadapa.', temperature=0.7, max_new_tokens=4096, Topp=0.5, Repetitionpenalty=1.2):
|
36 |
with st.status("Starting client"):
|
|
|
61 |
st.title(TITLE)
|
62 |
st.write(DESCRIPTION)
|
63 |
|
64 |
+
# Initialize session state
|
65 |
+
if "messages" not in st.session_state:
|
66 |
+
st.session_state.messages = []
|
67 |
+
|
68 |
# Display chat messages from history on app rerun
|
69 |
for message in st.session_state.messages:
|
70 |
with st.chat_message(message["role"], avatar=("π§βπ»" if message["role"] == 'human' else 'π¦')):
|
71 |
st.markdown(message["content"])
|
72 |
|
73 |
textinput = st.chat_input("Ask AgriTure anything...")
|
74 |
+
|
75 |
# Assume st_audiorec is a simplified audio recorder function
|
76 |
wav_audio_data = st.audio_recorder()
|
77 |
|
|
|
107 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
108 |
|
109 |
# Convert response to audio
|
110 |
+
text_to_speech(response)
|