venkat charan commited on
Commit
4004a93
·
verified ·
1 Parent(s): 7572300

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_openai import ChatOpenAI
2
+ from langchain_core.prompts import ChatPromptTemplate
3
+ import streamlit as st
4
+ import os
5
+
6
+ openai_api_k = os.getenv("openai_key")
7
+
8
+
9
+ llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo",openai_api_key=openai_api_k,max_tokens=160)
10
+
11
+
12
+ prompt = ChatPromptTemplate.from_messages([
13
+ ("system", "You are a good chef.You are a helpful assistant that suggests me how to cook a dish")
14
+ ("human", "Give a proper way with mentioning ingredients\n{input}")
15
+ ])
16
+
17
+ st.title("Dish Maker")
18
+ st.write("Enter the dish you want to make:")
19
+
20
+
21
+ dish = st.text_area("Dish")
22
+
23
+ if st.button("Generate process"):
24
+ chain = prompt | llm
25
+ response = chain.invoke({"input": dish})
26
+ st.write(response.content)