File size: 933 Bytes
4004a93
 
 
 
 
7ffed93
4004a93
 
 
 
 
 
b088b6f
 
 
4004a93
 
 
 
b088b6f
4004a93
 
 
b088b6f
 
 
 
 
 
 
 
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
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
import streamlit as st
import os

openai_api_k = os.getenv("openai_api")


llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo",openai_api_key=openai_api_k,max_tokens=160)


prompt = ChatPromptTemplate.from_messages([
        ("system", "You are a good chef. You are a helpful assistant that suggests how to cook a dish."),
        ("human", "Give a proper way with mentioning ingredients\n{input}")
    ])

st.title("Dish Maker")
st.write("Enter the dish you want to make:")

    # User input
dish = st.text_area("Dish")

if st.button("Generate process"):
        chain = prompt | llm
        response = chain.invoke({"input": dish})
        
        if response:
            st.write("Generated Cooking Process:")
            st.write(response.content)
        else:
            st.write("No response from the model. Please try again.")