import os import openai from gtts import gTTS import streamlit as st openai.api_key = os.getenv("OPENAI_API_KEY") KIITEC_CONTENT = """ KIITEC is a technical institution registered by NACTE (REG/EOS/027) based in Moshono, Arusha next to Masai Camp. The institute was founded in 2004 by French engineers and has thence contrived to produce the most competent technicians in the country. The institute is financed and supported by two NGOs: The Foundation for Technical Education (FTE-Swiss) and Action Development Education International (ADEI-French). In 2004, ADEI's partner FTE built the Kilimanjaro International Institute of Telecommunications, Electronics and Computers (KIITEC) introducing state-of-the-art teaching facilities to train technicians in Arusha, Tanzania. Following construction, ADEI joined FTE in its ambition to make change through technical education and has played a pivotal role in the on-the-ground education programming and training at KIITEC ever since. Today, KIITEC acts as the international training center where educators travel from different corners of Africa to upgrade their skills. Resting on a 15-acre campus with hostel available inside it, KIITEC offers the most advanced targeted training technologies in the region. The innovative education model developed at KIITEC is based on a hands-on and student-centered approach to learning with full access to modern learning equipment simulating real-world practical experiences. The training center is registered and accredited by the National Council for Technical Education (NACTE) and awards successful graduates with a 3-year National Technical Award Level Six (NTA-6) Diploma. KIITEC specializes in diploma programs including: - Electrical & Computer Engineering - Electrical & Industrial Automation - Electronics & Telecommunication Engineering - Electrical & Renewable Energies Short course programs offered by KIITEC include: - Computer Application - IT & System Security - Electrical Domestic & Solar PV System Installation Future training programs or courses in development: Biomedical, Avionics. ADMISSION REQUIREMENTS of ELECTRONICS AND TELECOMMUNICATION ENGINEERING: - Possession of a Certificate of Secondary Education Examinations (CSEE) with a minimum of FOUR passes, of which TWO must be among the following subjects: Mathematics, Physics/Engineering Science, Biology, and Chemistry; excluding religious subjects. - OR Possession of a National Vocational Award (NVA) Level III in Electrical, Electronics, Telecommunication, Mechanical, and related fields offered by VETA and a Certificate of Secondary Education Examination (CSEE) with at least two passes. ADMISSION REQUIREMENTS of ELECTRICAL AND INDUSTRIAL AUTOMATION ENGINEERING: - Possession of a Certificate of Secondary Education Examinations (CSEE) with a minimum of FOUR passes, of which TWO must be among the following subjects: Mathematics, Physics/Engineering Science, Biology, and Chemistry; excluding religious subjects. - OR Possession of a National Vocational Award (NVA) Level III in Electrical, Electronics, Telecommunication, Mechanical, and related fields offered by VETA and a Certificate of Secondary Education Examination (CSEE) with at least two passes. ADMISSION REQUIREMENTS of ELECTRICAL AND COMPUTER ENGINEERING PROGRAMS: - Possession of a Certificate of Secondary Education Examinations (CSEE) with a minimum of FOUR passes, of which TWO must be among the following subjects: Mathematics, Physics/Engineering Science, Biology, and Chemistry; excluding religious subjects. - OR Possession of a National Vocational Award (NVA) Level III in Electrical, Electronics, Telecommunication, Mechanical, and related fields offered by VETA and a Certificate of Secondary Education Examination (CSEE) with at least two passes. ADMISSION REQUIREMENTS of ELECTRICAL AND RENEWABLE ENERGY ENGINEERING: - Possession of a Certificate of Secondary Education Examinations (CSEE) with a minimum of FOUR passes, of which TWO must be among the following subjects: Mathematics, Physics/Engineering Science, Biology, and Chemistry; excluding religious subjects. - OR Possession of a National Vocational Award (NVA) Level III in Electrical, Electronics, Telecommunication, Mechanical, and related fields offered by VETA and a Certificate of Secondary Education Examination (CSEE) with at least two passes. APPLICATION FOR EITHER DIPLOMA COURSE OR SHORT COURSE - You can apply for Diploma Course through this link https://kiitec.ac.tz/apply-here/ - You can apply for short Course through this link https://kiitec.ac.tz/apply-here/ Fee structure and Mode of Payment for Diploma Programs: - The first semester fee is 695,000 Tsh and can be paid in two installments before the end of the semester. - The second semester fee is 625,000 Tsh and can be paid in two installments before the end of the semester. - The fees should be paid through the Bank of ABSA, Account number 002-4001687, Account Name KIITEC. KIITEC students wear uniforms. The uniforms consist of light blue shirts and dark blue sweaters, dark blue skirts, and dark blue trousers. KIITEC Vision: To become a leading provider of quality technical education and training to empower the youth of Tanzania and the Eastern Africa region. KIITEC Mission: - To provide quality hands-on technical training for students in ICTs, Electrical, Renewable Energies, Industrial Automation, and related disciplines. - To conduct quality research and consultancy in these fields. - To promote the development and usage of modern technology that meets national, regional, and international needs and standards through skills and practical-oriented training. KIITEC Values: - Hard work and excellence - Honesty - Respect - Responsibility - Lifelong learning - Innovation and creativity. For contact information: - Phone: +255 27 250 4384 - Mobile: +255 757 845 118 - Email: info@kiitec.ac.tz - P.O. Box 3172, Arusha """ def generate_response(user_input): response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"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}, {"role": "assistant", "content": "Hi, how can i assist you today?"}, {"role": "user", "content": user_input}, ] ) return response['choices'][0]['message']['content'] def text_to_speech(text): # Create a text-to-speech object tts = gTTS(text=text, lang=('en')) # Save the audio file tts.save('output.mp3') # Play the audio file st.audio("output.mp3") def main(): st.image('logo.png', caption=None, width="auto", use_column_width=None, clamp=False, channels="RGB", output_format="auto") st.markdown("

KILIMANJARO INTERNATIONAL INSTITUTE FOR TELECOMMUNICATION, ELECTRONICS &COMPUTERS

", unsafe_allow_html=True) st.title("KIITEC VIRTUAL ASSISTANT") user_input = st.text_input("Enter your question:") if st.button("Generate"): with st.spinner("Generating Response...."): response_text = generate_response(user_input) st.write("Response:", response_text) text_to_speech(response_text) if __name__ == '__main__': main()