Join this channel to get access to perks:
youtube.com/channel/UCcA2nhdC0wzqyv9x1lk5NnA/join
GenAI Apps Playlist Link:
• Master Generative AI App Development: Full...…
Code
!pip install -q langchain langchain_openai streamlit
!npm install localtunnel
import os
from google.colab import userdata
os.environ[‘OPENAI_API_KEY'] = userdata.get(‘openai’)
from google.colab import drive
drive.mount('/content/drive')
!streamlit run drive/MyDrive/colab_files/demo_translator_groq.py
!npx localtunnel --port 8501
demo_translator_openai.py
import streamlit as st
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
model = ChatGroq(model="gpt”-4o, temperature=0)
def translator_text(text,language):
prompt = ChatPromptTemplate.from_messages([
("system", f"""You are a professional translator. Your task is to accurately translate the given English text into {language}.
Preserve the original meaning, tone, and context.
Provide a natural, fluent translation.
Avoid unnecessary explanations or additional text—return only the translated sentence.
"""),
("human", "{text}"),
])
chain = prompt | model | StrOutputParser()
return chain.invoke({"text": text})
st.title(“OpenAI Translator")
languages = [
"Hindi", "Tamil", "Malayalam", "French", "Spanish",
"German", "Chinese", "Japanese", "Arabic", "Portuguese"
]
selected_languages = st.multiselect("Select languages to translate into:", languages, default=["Hindi", "Tamil","Malayalam"])
user_input = st.text_area("Enter text to translate", "")
if st.button("Translate"):
if user_input.strip():
with st.spinner("Translating.."):
translations = {lang: translator_text(user_input,lang) for lang in selected_languages}
st.write(selected_languages)
st.write(translation)
st.subheader("Translations:")
for lang, translation in translations.items():
st.write(f"**{lang}:** {translation}")
else:
st.warning("Please enter some text")
GenAI app basic class
This video demonstrates how to build a genAI app using Langchain, open api key, and streamlit in google colab for free
step-by-step guide on genai apps
How to generate open api key
Add pay as u go credit balance in open
Buy api credits form testing
Convert langchain_groq code to open code
Pip install langchain_openai
Stream helps to create simple and interactive interface
Good for prototypes
Exposing web server from google collab
How to install streamline app
Basics of streamline
Add button in streamlit
Store streamline log in to file
Use local tunnel to expose port
Pip install -q streamlit
npm install localtunnel
How to access google drive from google colab
Store python files in google drive for google collar to access it
From google.colab import drive
drive.mount(‘/content/drive’)
Build a basic app using streamlit
Beginner tutorial for streamlit
Expose collar we in to internet
Streamlit run python.py
Npx localtunnel —port 8501
Add numbers input filed in to streamlit
Genai beginner level training
Langchain introduction
Langchain ChatPromptTemplate
How to create a template prompt using langchain
Genai prompt creation example
Pass the template in to chat promp
input_variables in langchain
stroutputParser() in langchain
What in chain in lanchain
How to dynamically pass the variables
Create dynamic and reusable chat template tutorial
Langchai
groq api tutorial
Pass variable dynamically
Google collaborated access example for generative ai and lang chain coding
Genai beginner environment setup
Advantage of using google cola for genai development
How to install python package in to google colab
Langchain example
How to write code using langchain
os.environ[‘’GROQ_API_KEY]
How to use groq chat model
From langhcain_groq import ChatGroq
What is chat model
Create a groq chat model
Set the manual model name for LLM
LLM model and temperature explained
groq api,
streamlit
pip install streamlit
streamlit python
streamlit app
streamlit documentation
streamlit button
streamlit api
streamlit app examples
localtunnel app
localtunnel tutorial
localtunnel status
localtunnel options
localtunnel me
google colab genai
google colab gpt
google colab gpt 3
google colab gan
google genai
how to google colab
is google colab a jupyter notebook
is google colab python
connect google colab to github
genai essentials,
genai essentials full course for beginners,
genai projects,
genai use cases,
genai applications,
genai application development
genai beginners,
genai projects for beginners,
genai roadmap for beginners,
gen ai beginner projects,
gen ai beginner,
beginner guide to ai,
python for ai beginners,
genai essentials for beginners
genai beginners,
genai projects for beginners,
genai roadmap for beginners,
langchain beginner,
langchain beginner tutorial,
langchain step by step,
langchain in production,
コメント