Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,32 @@
|
|
1 |
-
# Q&A Chatbot
|
2 |
-
from langchain.llms import OpenAI
|
3 |
-
from dotenv import load_dotenv
|
4 |
-
import streamlit as st
|
5 |
-
import os
|
6 |
-
|
7 |
-
load_dotenv() # take environment variables form .env
|
8 |
-
|
9 |
-
|
10 |
-
# Function to load OpenaI Model and get response
|
11 |
-
def get_openai_response(question):
|
12 |
-
llm=OpenAI(
|
13 |
-
reponse=llm(question)
|
14 |
-
return reponse
|
15 |
-
|
16 |
-
### Initialize our streamlit app
|
17 |
-
|
18 |
-
st.set_page_config(page_title="Q&A Demo")
|
19 |
-
|
20 |
-
st.header("Langchain Application")
|
21 |
-
|
22 |
-
input=st.text_input("Input: ",key=input)
|
23 |
-
reponse=get_openai_response(input)
|
24 |
-
|
25 |
-
|
26 |
-
submit=st.button("As the question")
|
27 |
-
|
28 |
-
## IF ask button is clicked
|
29 |
-
|
30 |
-
if submit:
|
31 |
-
st.subheader("The Reponse is")
|
32 |
st.write(reponse)
|
|
|
1 |
+
# Q&A Chatbot
|
2 |
+
from langchain.llms import OpenAI
|
3 |
+
#from dotenv import load_dotenv
|
4 |
+
import streamlit as st
|
5 |
+
import os
|
6 |
+
|
7 |
+
load_dotenv() # take environment variables form .env
|
8 |
+
|
9 |
+
|
10 |
+
# Function to load OpenaI Model and get response
|
11 |
+
def get_openai_response(question):
|
12 |
+
llm=OpenAI(model_name="gpt-3.5-turbo-instruct",temperature=0.5)
|
13 |
+
reponse=llm(question)
|
14 |
+
return reponse
|
15 |
+
|
16 |
+
### Initialize our streamlit app
|
17 |
+
|
18 |
+
st.set_page_config(page_title="Q&A Demo")
|
19 |
+
|
20 |
+
st.header("Langchain Application")
|
21 |
+
|
22 |
+
input=st.text_input("Input: ",key=input)
|
23 |
+
reponse=get_openai_response(input)
|
24 |
+
|
25 |
+
|
26 |
+
submit=st.button("As the question")
|
27 |
+
|
28 |
+
## IF ask button is clicked
|
29 |
+
|
30 |
+
if submit:
|
31 |
+
st.subheader("The Reponse is")
|
32 |
st.write(reponse)
|