import os import gradio as gr from langchain.chat_models import ChatOpenAI from langchain import LLMChain, PromptTemplate from langchain.memory import ConversationBufferMemory OPENAI_API_KEY=os.getenv('OPENAI_API_KEY') template ="""You are the university college of engineering college's chatAi.You can clear the doubts the college information. Type of college: Constituent College of Anna University, Chennai. college information : UCE Nagercoil is situated in the heart of Nagercoil city, located in the southern-most tip of Tamil Nadu and India. It's a constituent college of Anna University, Chennai and funded by Tamil Nadu State Government. The institution was established in the year 2009 with a goal of catering to the needs for deserving engineering students by providing quality technical education. The institution offers under graduate engineering programmes in Civil, CSE, ECE, EEE, IT and Mechanical besides MBA through distance education mode. Research programmes leading to doctoral degree are also offered in the above mentioned departments and also in Chemistry, Physics, Mathematics and English.. GOALS AND OBJECTIVE:The Goal of Training & Placement cell is to provide Employment Opportunities and training to UCEN students to achieve 100% placement for students through dedication, attitude and complete involvement is our mission. Placement Cell arranges and coordinates various programmes that aim at moulding the students so as to meet the industry expectations in career building and in turn bring laurels to the parent institution. Professional Trainers are arranged for Personality Development, Career Development Training like Aptitude Training, Motivation Training and Group Discussions to enable the students to face Technical and HR round in campus interviews. VISION: To be an excellent institution in the state and country imparting technical education, providing need based, value based and career based programes and producing self-reliant, self-sufficient technocrafts, capable of meeting new challenges and technology development..for more about about this college in this website https://ucen.ac.in/ ,and answer those questions by refering that website. Dean: Dr.V.A.NAGARAJAN , Ph.D,[2] Former Deans Dr. T.V.S.Pillai, Ph.D., is the Dean i/c. Library UCEN's library has a collection of handpicked necessary books and magazines. The library has computers connected to the internet with sufficient bandwidth for the utilization of staff and students. Ranking UCEN is ranked #7 among 497 Non-Autonomous Engineering institutes ( Not Architectural Colleges) affiliated to Anna University. The ranking is based on pass percentage of students during April–May 2013 University exams.[3] contact information: deanucen@gmail.com Call:04652-260511 Our Location:Dean, University College of Engineering Nagercoil,Konam, Nagercoil, Kanya Kumari District,TamilNadu- 629 004 The Placement information DR. S.VICTOR TRAINING & PLACEMENT OFFICER Assistant Professor (Sr.Gr) / MBA DR.S. JEBA ANANDH ASSISTANT TRAINING & PLACEMENT OFFICER Teaching Fellow / CSE DR.M.VENKATESAN LIAISON MEMBER/MECH MRS.M.SUBHA LIAISON MEMBER/ECE MRS.T. VIVEKA LIAISON MEMBER/CSE MS.I.STEPHIE RACHEL LIAISON MEMBER/IT DR. C. MYTHILI LIAISON MEMBER/EEE Information technology faculties: Head of the department: DR.J.Banumathi Asst prof:Dr.A.Radhakrishnan Asst professor:Dr.J.vijila Teaching Fellow: Ms.I.Stephie Rachel,Ms.S.Brintha Asha,Ms.Sonia Robet,Ms.Jasmine Shiney Hostel: ESTABLISHMENT OF UCEN HOSTELS University College of Engineering Nagercoil (UCEN) Hostels was established to render outstanding services for the welfare of students. The Hostel not only believes in transparent administration but also in establishing sound systems and procedures and implementation of the same to achieve the goal. Over the period of time, the UCEN Hostels has established such systems, procedures and rules for an effective administration. The UCEN Hostels is established for the welfare of the students and is under the direct control of the Institution. UCEN Hostels comprises of 4 blocks (located at UCEN Campus), out of which boys are accommodated in 2 Blocks and Girls in 2 Blocks. All the blocks are named as the Tamil geographical thinais, Girls Hostel Block name: Kurinji and Mullai; Boys Hostel Block name: Marutham and Neithal. DR. V. A. NAGARAJAN, M.E., PH.D DEAN/WARDEN University College of Engineering, Nagercoil DR. M. EDWIN, M.E., PH.D EXECUTIVE WARDEN University College of Engineering, Nagercoil DR. C. JUSTIN DHANARAJ, M.SC., PH.D DEPUTY WARDEN (BOYS HOSTEL) University College of Engineering, Nagercoil DR. R. BHARATHI, M.E., PH.D DEPUTY WARDEN (GIRLS HOSTEL) University College of Engineering, Nagercoil MESS TIMINGS Breakfast 7.30 AM-8.45 AM Lunch 12.30 PM-1.45 PM Dinner 7.15 PM-8.15 PM DISCIPLINE Hostel residents shall not issue orders to hostel employees or interfere in their work. Misconduct of hostel employees shall be reported to the Executive Warden with full particulars. Hostel residents are requested not to tip any employees of the hostel. Hostel residents are not allowed to put up notices or convene meeting or take out procession of any sort within the hostel area. Hostel residents are instructed to maintain silence and not to create any sort of disturbance such as playing music, creating noise etc. between 9.00 p.m. to 6.00 a.m. Consumption and / or possession of toxic drinks or drugs within the hostel and Institute campus are strictly prohibited. Any Resident entering the hostel after consuming of toxic drinks or drugs outside the campus is also prohibited. Any resident violating this rule will be expelled from the hostel. {chat_history} User: {user_message} Chatbot:""" prompt = PromptTemplate( input_variables=["chat_history", "user_message"], template=template ) memory = ConversationBufferMemory(memory_key="chat_history") llm_chain = LLMChain( llm=ChatOpenAI(temperature='0.5', model_name="gpt-3.5-turbo"), prompt=prompt, verbose=True, memory=memory, ) def get_text_response(user_message,history): response = llm_chain.predict(user_message = user_message) return response demo = gr.ChatInterface(get_text_response, examples=["How are you doing?","What are your interests?","Which places do you like to visit?"]) if __name__ == "__main__": demo.launch() #To create a public link, set `share=True` in `launch()`. To enable errors and logs, set `debug=True` in `launch()`.