Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -100,96 +100,6 @@ For contact information:
|
|
100 |
- Email: [email protected]
|
101 |
- P.O. Box 3172, Arusha
|
102 |
"""
|
103 |
-
#client = OpenAI()
|
104 |
-
|
105 |
-
#def generate_response(user_input):
|
106 |
-
# response = client.completions.create(
|
107 |
-
# model="gpt-3.5-turbo",
|
108 |
-
# messages=[
|
109 |
-
# {"role": "system", "content": "All your answers should be in Swahili or English. Consider the language that the user has asked with, and your kiitec virtual assistant your designed or created by WALTER RICHARD So, here we start... Your virtual assistant of DON BOSCO KIITEC. You will reply to the queries that the user might ask!\n\n" + KIITEC_CONTENT},
|
110 |
-
# {"role": "assistant", "content": "Hi, how can i assist you today?"},
|
111 |
-
# {"role": "user", "content": user_input},
|
112 |
-
# ]
|
113 |
-
# )
|
114 |
-
#return response['choices'][0]['message']['content']
|
115 |
-
#return response.choices[0].message.content
|
116 |
-
|
117 |
-
#def text_to_speech(text):
|
118 |
-
# Create a text-to-speech object
|
119 |
-
# tts = gTTS(text=text, lang=('en'))
|
120 |
-
# # Save the audio file
|
121 |
-
# tts.save('output.mp3')
|
122 |
-
|
123 |
-
# # Play the audio file
|
124 |
-
# st.audio("output.mp3")
|
125 |
-
|
126 |
-
#def main():
|
127 |
-
|
128 |
-
# col1, col2 = st.columns([1, 4])
|
129 |
-
|
130 |
-
# with col1:
|
131 |
-
# st.image('logo.png', caption=None, width=200, use_column_width=200)
|
132 |
-
|
133 |
-
# with col2:
|
134 |
-
# st.markdown("<h4 style='text-align: center; color: white;'>KILIMANJARO INTERNATIONAL INSTITUTE FOR TELECOMMUNICATION, ELECTRONICS & COMPUTERS</h4>", unsafe_allow_html=True)
|
135 |
-
# st.header("KIITEC VIRTUAL ASSISTANT")
|
136 |
-
# st.write("Welcome for questions concerning kiitec insitution")
|
137 |
-
# user_input = st.text_input("Enter your question:")
|
138 |
-
# if st.button("Answer"):
|
139 |
-
# with st.spinner("Generating Response...."):
|
140 |
-
# response_text = generate_response(user_input)
|
141 |
-
# st.write("Answer:", response_text)
|
142 |
-
# text_to_speech(response_text)
|
143 |
-
|
144 |
-
#if __name__ == '__main__':
|
145 |
-
# main()
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
# create OpenAI client
|
150 |
-
# create OpenAI client
|
151 |
-
#client = OpenAI()
|
152 |
-
|
153 |
-
#def generate_response(user_input):
|
154 |
-
#prompt = "All your answers should be in Swahili or English. Consider the language that the user has asked with, and your kiitec virtual assistant your designed or created by WALTER RICHARD So, here we start... Your virtual assistant of DON BOSCO KIITEC. You will reply to the queries that the user might ask!\n\n" + KIITEC_CONTENT
|
155 |
-
# response = client.completions.create(
|
156 |
-
# engine="gpt-3.5-turbo",
|
157 |
-
# messages=[
|
158 |
-
# {"role": "system", "content": "All your answers should be in Swahili or English. Consider the language that the user has asked with, and your kiitec virtual assistant your designed or created by WALTER RICHARD So, here we start... Your virtual assistant of DON BOSCO KIITEC. You will reply to the queries that the user might ask!\n\n" + KIITEC_CONTENT},
|
159 |
-
# {"role": "assistant", "content": "Hi, how can i assist you today?"},
|
160 |
-
# {"role": "user", "content": user_input},
|
161 |
-
# ]
|
162 |
-
# )
|
163 |
-
# return response.choices[0].message.content
|
164 |
-
|
165 |
-
#def text_to_speech(text):
|
166 |
-
# Create a text-to-speech object
|
167 |
-
# tts = gTTS(text=text, lang='en')
|
168 |
-
# Save the audio file
|
169 |
-
# tts.save('output.mp3')
|
170 |
-
|
171 |
-
# Play the audio file
|
172 |
-
# st.audio("output.mp3")
|
173 |
-
|
174 |
-
#def main():
|
175 |
-
# col1, col2 = st.columns([1, 4])
|
176 |
-
|
177 |
-
# with col1:
|
178 |
-
# st.image('logo.png', caption=None, width=200, use_column_width=200)
|
179 |
-
|
180 |
-
# with col2:
|
181 |
-
# st.markdown("<h4 style='text-align: center; color: white;'> KILIMANJARO INTERNATIONAL INSTITUTE FOR TELECOMMUNICATION, ELECTRONICS & COMPUTERS</h4>", unsafe_allow_html=True)
|
182 |
-
# st.header("KIITEC VIRTUAL ASSISTANT")
|
183 |
-
# st.write("Welcome for questions concerning kiitec institution")
|
184 |
-
# user_input = st.text_input("Enter your question:")
|
185 |
-
# if st.button("Answer"):
|
186 |
-
# with st.spinner("Generating Response...."):
|
187 |
-
# response_text = generate_response(user_input)
|
188 |
-
# st.write("Answer:", response_text)
|
189 |
-
# text_to_speech(response_text)
|
190 |
-
|
191 |
-
#if __name__ == '__main__':
|
192 |
-
# main()
|
193 |
def generate_response(user_input):
|
194 |
response = client.chat.completions.create(
|
195 |
model="gpt-3.5-turbo",
|
|
|
100 |
- Email: [email protected]
|
101 |
- P.O. Box 3172, Arusha
|
102 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
def generate_response(user_input):
|
104 |
response = client.chat.completions.create(
|
105 |
model="gpt-3.5-turbo",
|