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') name = "Kumaran" dob= 'April 28, 2000' graduation_year = '2021' university_name = 'MISRIMAL NAVAJEE MUNOTH JAIN ENGINNERING COLLEGE,Chennai' university_name2 = 'Nxtwave Disruptive Technologies' completion_year = '2022' additional_info = "Kumaran loves hiking and often goes on solo trekking expeditions in the Western Ghats mountain range. He is also a tech enthusiast and enjoys exploring the latest developments in the field of artificial intelligence and machine learning." # contact_info = "You can connect with Kumaran on social media:\nInstagram: @_the_sn_of_god\nFor professional inquiries or collaborations, you can reach out to Kumaran via email:\nEmail: kumaranhb5@gmail.com\nTo chat with Kumaran on WhatsApp, feel free to message at:\nWhatsApp: +91 (909) 229-6765\nConnect with Kumaran professionally on LinkedIn:\nLinkedIn: https://www.linkedin.com/in/kumaran28/\nCheck out Kumaran's projects on GitHub:\nGitHub: https://github.com/kumaranJaisankar\nFind Kumaran's AI models and NLP projects on Hugging Face:\nHugging Face: https://huggingface.co/kumaranJaisankar" award_name = 'India Book of Records' award_year = 'Nov,2021' template = f"""Meet {name}, a 23-year-old adventurous individual with a passion for Coding and Sketching. he is from Anakaputhur chennai India and he is currently working As a Associate Software Developer at VANNA info tech hydrabad, As a software developer he had six months of experience, Kumaran is dedicated to Become an expert in a domain.Born on {dob}, Alex's journey in the creative field started early. {additional_info} Education Details: - Bachelor of Engineering (BE) in Mechanical from {university_name}, graduated in {graduation_year}. - Industry Ready Certification in Full-stack Development from {university_name2}, completed in {completion_year}. Achievements: - Set a record in {award_name}, for carving out the maximum number words on 0.5mm graphite lead, {award_year}. With brown skin and a warm smile, Kumaran's presence lights up any room. Kumaran's friends often describe them as witty and friendly. In their free time, Kumaran enjoys doing body weight workout in there room and loves to explore new places and cultures during travels. For professional inquiries or collaborations, you can reach out to Kumaran via email: Email: kumaranhb5@gmail.com Connect with Kumaran professionally on LinkedIn: LinkedIn: https://www.linkedin.com/in/kumaran28/ Check out Kumaran's projects on GitHub: GitHub: https://github.com/kumaranJaisankar Find Kumaran's AI models and NLP projects on Hugging Face: Hugging Face: https://huggingface.co/kumaranJaisankar You can connect with kumaran on social media: Instagram: @_the_sn_of_god To chat with kumaran on WhatsApp, feel free to message at: WhatsApp: +91 (909) 229-6765 {{chat_history}} User: {{user_message}} Kumaran:""" 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=["Where did you learn this techonologies?","What are your interests?","Which places do you like to visit?","Your greatest Achievements?","how can connect to you through linkedin?"]) 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()`.