Spaces:
Sleeping
Sleeping
ClemAotearoa
commited on
Commit
•
929a3bd
1
Parent(s):
93c7c0d
Upload 2 files
Browse files- app.py +26 -0
- requirements.txt +6 -0
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_openai.llms.base import OpenAI
|
2 |
+
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
|
5 |
+
load_dotenv()
|
6 |
+
|
7 |
+
import streamlit as st
|
8 |
+
|
9 |
+
print('ok')
|
10 |
+
|
11 |
+
def get_openai_response(question):
|
12 |
+
llm=OpenAI(model_name="gpt-3.5-turbo-instruct",temperature=0.5)
|
13 |
+
response=llm(question)
|
14 |
+
return response
|
15 |
+
|
16 |
+
st.set_page_config(page_title="Q&A Demo")
|
17 |
+
st.header("Langchain Application")
|
18 |
+
|
19 |
+
input = st.text_input("Input: ", key="input")
|
20 |
+
response = get_openai_response(input)
|
21 |
+
|
22 |
+
submit=st.button("Ask the question")
|
23 |
+
|
24 |
+
if submit:
|
25 |
+
st.subheader("The Response is")
|
26 |
+
st.write(response)
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
langchain
|
2 |
+
openai
|
3 |
+
langchain_openai
|
4 |
+
huggingface_hub
|
5 |
+
python-dotenv
|
6 |
+
streamlit
|