yashasgupta's picture
Update app.py
75978fd verified
raw
history blame
740 Bytes
import streamlit as st
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
import os
os.environ["OPENAI_API_KEY"] = os.getenv("k1")
st.markdown("Translation Application")
options = ["English","Telugu","Hindi"]
st.write("Input langauge")
st.selectbox('Choose an option:', options)
st.write("Output langauge")
st.selectbox('Choose an option:', options)
llm = ChatOpenAI(model = "gpt-3.5-turbo",temperature = 0)
prompt = ChatPromptTemplate.from_messages([("system","you are a good assistant for translation to {il} to {ol}"),
("human","{i}")])
chain = prompt|llm
re = chain.invoke({"il":"english","ol":"french", "i":"what is the capital of India"})
st.write(re.content)