Spaces:
Build error
Build error
Download app.py from matheen22/simplechat: direct link, hf CLI and curl.
- Browser
- Download file 557 Bytes
-
https://huggingface.co/spaces/matheen22/simplechat/resolve/main/app.py
- Command line
-
hf download hf://spaces/matheen22/simplechat/app.py
-
curl -L -o app.py https://huggingface.co/spaces/matheen22/simplechat/resolve/main/app.py
557 Bytes
| from langchain.llms import OpenAI | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| import streamlit as st | |
| import os | |
| def get_openai_response(question): | |
| llm=OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"), | |
| temperature=0.5) | |
| response=llm(question) | |
| return response | |
| st.set_page_config(page_title="Q&A Demo") | |
| input=st.text_input("Input: ",key="input") | |
| response=get_openai_response(input) | |
| st.header("Langchain Application") | |
| submit=st.button("Ask the question") | |
| if submit: | |
| st.subheader("The Response is") | |
| st.write(response) |