File size: 698 Bytes
7832925
 
3ac4f4b
 
 
 
75978fd
 
 
3ac4f4b
 
bb407cf
 
 
 
75978fd
 
4d22635
75978fd
 
 
4d22635
bb407cf
 
 
3ac4f4b
 
 
 
 
bb407cf
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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(options)

st.write("Output langauge")

st.selectbox(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)