Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,9 +6,21 @@ from langchain_core.prompts import ChatPromptTemplate
|
|
| 6 |
|
| 7 |
os.environ["OPENAI_API_KEY"] = os.getenv("k1")
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
prompt = ChatPromptTemplate.from_messages([("system","you are a good assistant for translation to {il} to {ol}"),
|
| 10 |
("human","{i}")])
|
| 11 |
|
| 12 |
chain = prompt|llm
|
| 13 |
|
| 14 |
-
re = chain.invoke({"il":"english","ol":"french","i":"what is the
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
os.environ["OPENAI_API_KEY"] = os.getenv("k1")
|
| 8 |
|
| 9 |
+
st.markdown("Translation Application")
|
| 10 |
+
|
| 11 |
+
options = ["English","Telugu","Hindi"]
|
| 12 |
+
|
| 13 |
+
st.selectbox('Choose an option:', options)
|
| 14 |
+
|
| 15 |
+
llm = ChatOpenAI(model = "gpt-3.5-turbo",temperature = 0)
|
| 16 |
+
|
| 17 |
prompt = ChatPromptTemplate.from_messages([("system","you are a good assistant for translation to {il} to {ol}"),
|
| 18 |
("human","{i}")])
|
| 19 |
|
| 20 |
chain = prompt|llm
|
| 21 |
|
| 22 |
+
re = chain.invoke({"il":"english","ol":"french", "i":"what is the capital of India"})
|
| 23 |
+
|
| 24 |
+
st.write(re.content)
|
| 25 |
+
|
| 26 |
+
|