Walterchamy commited on
Commit
1005767
1 Parent(s): 47b00df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -96
app.py CHANGED
@@ -1,110 +1,28 @@
1
- import streamlit as st
2
- import openai
3
-
4
  import os
 
 
5
 
6
  openai.api_key = os.getenv("OPENAI_API_KEY")
7
 
8
- # KIITEC content
9
- KIITEC_CONTENT = """
10
- KIITEC is a technical institution registered by NACTE (REG/EOS/027) based in Moshono, Arusha next to Masai Camp.
11
-
12
- 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.
13
-
14
- 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.
15
-
16
- 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.
17
-
18
- KIITEC specializes in diploma programs including:
19
- - Electrical & Computer Engineering
20
- - Electrical & Industrial Automation
21
- - Electronics & Telecommunication Engineering
22
- - Electrical & Renewable Energies
23
-
24
- Short course programs offered by KIITEC include:
25
- - Computer Application
26
- - IT & System Security
27
- - Electrical Domestic & Solar PV System Installation
28
-
29
- Future training programs or courses in development: Biomedical, Avionics.
30
-
31
- ADMISSION REQUIREMENTS of ELECTRONICS AND TELECOMMUNICATION ENGINEERING:
32
- - 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.
33
- - 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.
34
-
35
- ADMISSION REQUIREMENTS of ELECTRICAL AND INDUSTRIAL AUTOMATION ENGINEERING:
36
- - 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.
37
- - 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.
38
-
39
- ADMISSION REQUIREMENTS of ELECTRICAL AND COMPUTER ENGINEERING PROGRAMS:
40
- - 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.
41
- - 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.
42
-
43
- ADMISSION REQUIREMENTS of ELECTRICAL AND RENEWABLE ENERGY ENGINEERING:
44
- - 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.
45
- - 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.
46
-
47
-
48
- APPLICATION FOR EITHER DIPLOMA COURSE OR SHORT COURSE
49
- - You can apply for Diploma Course through this link https://kiitec.ac.tz/apply-here/
50
- - You can apply for short Course through this link https://kiitec.ac.tz/apply-here/
51
-
52
- Fee structure and Mode of Payment for Diploma Programs:
53
- - The first semester fee is 695,000 Tsh and can be paid in two installments before the end of the semester.
54
- - The second semester fee is 625,000 Tsh and can be paid in two installments before the end of the semester.
55
- - The fees should be paid through the Bank of ABSA, Account number 002-4001687, Account Name KIITEC.
56
-
57
- KIITEC students wear uniforms. The uniforms consist of light blue shirts and dark blue sweaters, dark blue skirts, and dark blue trousers.
58
-
59
- KIITEC Vision:
60
- To become a leading provider of quality technical education and training to empower the youth of Tanzania and the Eastern Africa region.
61
-
62
- KIITEC Mission:
63
- - To provide quality hands-on technical training for students in ICTs, Electrical, Renewable Energies, Industrial Automation, and related disciplines.
64
- - To conduct quality research and consultancy in these fields.
65
- - To promote the development and usage of modern technology that meets national, regional, and international needs and standards through skills and practical-oriented training.
66
-
67
- KIITEC Values:
68
- - Hard work and excellence
69
- - Honesty
70
- - Respect
71
- - Responsibility
72
- - Lifelong learning
73
- - Innovation and creativity.
74
-
75
- For contact information:
76
- - Phone: +255 27 250 4384
77
- - Mobile: +255 757 845 118
78
- - Email: [email protected]
79
- - P.O. Box 3172, Arusha
80
- """
81
-
82
-
83
  def generate_response(user_input):
84
  response = openai.ChatCompletion.create(
85
  model="gpt-3.5-turbo",
86
  messages=[
87
- {"role": "system", "content": "All your answers should be in Swahili or English, considering the language that the user has asked in. Let's get started... I am your virtual assistant for DON BOSCO KIITEC. I can help answer any questions you might have!"},
 
88
  {"role": "user", "content": user_input},
89
- {"role": "assistant", "content": ""}
90
  ]
91
  )
 
92
 
93
- assistant_response = response.choices[0].message.content
94
-
95
- # Incorporate the content about KIITEC into the assistant's response
96
- if "kiitec" in user_input.lower():
97
- assistant_response += "\n\n" + "Here is some information about KIITEC:\n" + KIITEC_CONTENT
98
-
99
- return assistant_response
100
-
101
 
102
- # Streamlit interface
103
- def streamlit_interface():
104
- st.title("KIITEC VIRTUAL ASSISTANT")
105
- user_input = st.text_input("You: ")
106
 
107
- if st.button("Submit"):
108
- assistant_response = generate_response(user_input)
109
- st.text("Kiitec Virtual Assistant:")
110
- st.text(assistant_response)
 
 
 
 
1
  import os
2
+ import openai
3
+ import streamlit as st
4
 
5
  openai.api_key = os.getenv("OPENAI_API_KEY")
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  def generate_response(user_input):
8
  response = openai.ChatCompletion.create(
9
  model="gpt-3.5-turbo",
10
  messages=[
11
+ {"role": "system", "content": "All your answers should be in swahili or english consider the language that the user has ask with, so here we start... Your virtual assistance of DON BOSCO KIITEC , you will reply the query that the user might ask !"},
12
+ {"role": "assistant", "content": "hi , there is any question concerning about DB kiitec that i might help?"},
13
  {"role": "user", "content": user_input},
 
14
  ]
15
  )
16
+ return response['choices'][0]['message']['content']
17
 
18
+ def main():
19
+ st.title("Chatbot Assistant")
20
+ user_input = st.text_input("Enter your question:")
21
+ if st.button("Generate"):
22
+ with st.spinner("Generating Response...."):
23
+ response_text = generate_response(user_input)
24
+ st.write("Response:", response_text)
 
25
 
26
+ if __name__ == '__main__':
27
+ main()
 
 
28