AjayKr09 commited on
Commit
6aa16fa
·
verified ·
1 Parent(s): 082bd98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -3,6 +3,8 @@ from langchain_openai import ChatOpenAI
3
  import os
4
  from langchain_core.prompts import ChatPromptTemplate
5
 
 
 
6
  llm = ChatOpenAI(model='gpt-3.5-turbo', temperature=0, max_tokens=150)
7
 
8
  st.header("Translation Application")
@@ -25,11 +27,16 @@ prompt = ChatPromptTemplate.from_messages(
25
  )
26
 
27
 
 
28
 
29
  chain = prompt|llm
30
 
31
  re = chain.invoke({
32
- 'il':il, 'ol': ol, 'i': 'i am good'
33
  })
34
 
35
- re.content
 
 
 
 
 
3
  import os
4
  from langchain_core.prompts import ChatPromptTemplate
5
 
6
+ os.environ['OPENAI_API_KEY'] = key
7
+
8
  llm = ChatOpenAI(model='gpt-3.5-turbo', temperature=0, max_tokens=150)
9
 
10
  st.header("Translation Application")
 
27
  )
28
 
29
 
30
+ input_text = st.text_area('Input Text', height=300)
31
 
32
  chain = prompt|llm
33
 
34
  re = chain.invoke({
35
+ 'il':il, 'ol': ol, 'i': input_text
36
  })
37
 
38
+ if st.button('Submit'):
39
+ if input_text:
40
+ st.write(re.content)
41
+ else:
42
+ st.write('Please enter correct text to translate.')