Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files7 unmodified lines8910111213141 unmodified line161718192021226 unmodified lines29303132333435363738397 unmodified lines## Load Anthropic model and get responsedef get_openai_response(question, api_key):system_template = "You are a helpful coder assistant. When the user asks a question, your task is to write simple Python codes."user_template = "{question}"chat_prompt = ChatPromptTemplate.from_messages([1 unmodified line("human", user_template)])chat_llm = ChatOpenAI(temperature=0.5, api_key=api_key)chain = chat_prompt | chat_llm6 unmodified linesst.header("Coder Q&A Demo")OPENAI_API_KEY = st.text_input("OpenAI API Key: ", type="password")input = st.text_input("Input: ", key=input)submit = st.button("Ask your question...")if submit:response = get_openai_response(input, api_key=OPENAI_API_KEY)st.subheader("The response is:")st.write(response)7 unmodified lines8910111213141 unmodified line161718192021226 unmodified lines2930313233343536373839407 unmodified lines## Load Anthropic model and get responsedef get_openai_response(question):system_template = "You are a helpful coder assistant. When the user asks a question, your task is to write simple Python codes."user_template = "{question}"chat_prompt = ChatPromptTemplate.from_messages([1 unmodified line("human", user_template)])chat_llm = ChatOpenAI(temperature=0.5)chain = chat_prompt | chat_llm6 unmodified linesst.header("Coder Q&A Demo")OPENAI_API_KEY = st.text_input("OpenAI API Key: ", type="password")os.environ["OPENAI_API_KEY"] = OPENAI_API_KEYinput = st.text_input("Input: ", key=input)submit = st.button("Ask your question...")if submit:response = get_openai_response(input)st.subheader("The response is:")st.write(response)
src/streamlit_app.py+4-3