Spaces:
Sleeping
Sleeping
Commit
·
639ca23
1
Parent(s):
528a70d
Upload app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,21 @@
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
|
4 |
-
from langchain.llms import
|
5 |
|
6 |
#Function to return the response
|
7 |
def load_answer(question):
|
8 |
-
llm =
|
9 |
answer=llm(question)
|
10 |
return answer
|
11 |
|
12 |
|
13 |
#App UI starts here
|
14 |
-
st.set_page_config(page_title="
|
15 |
-
st.header("
|
16 |
|
17 |
#Gets the user input
|
18 |
def get_text():
|
@@ -23,7 +26,7 @@ def get_text():
|
|
23 |
user_input=get_text()
|
24 |
response = load_answer(user_input)
|
25 |
|
26 |
-
submit = st.button('
|
27 |
|
28 |
#If generate button is clicked
|
29 |
if submit:
|
@@ -31,3 +34,4 @@ if submit:
|
|
31 |
st.subheader("Answer:")
|
32 |
|
33 |
st.write(response)
|
|
|
|
1 |
+
#Hello! It seems like you want to import the Streamlit library in Python. Streamlit is a powerful open-source framework used for building web applications with interactive data visualizations and machine learning models. To import Streamlit, you'll need to ensure that you have it installed in your Python environment.
|
2 |
+
#Once you have Streamlit installed, you can import it into your Python script using the import statement,
|
3 |
+
|
4 |
import streamlit as st
|
5 |
|
6 |
|
7 |
+
from langchain.llms import OpenAI
|
8 |
|
9 |
#Function to return the response
|
10 |
def load_answer(question):
|
11 |
+
llm = OpenAI(model_name="text-davinci-003",temperature=0)
|
12 |
answer=llm(question)
|
13 |
return answer
|
14 |
|
15 |
|
16 |
#App UI starts here
|
17 |
+
st.set_page_config(page_title="LangChain Demo", page_icon=":robot:")
|
18 |
+
st.header("LangChain Demo")
|
19 |
|
20 |
#Gets the user input
|
21 |
def get_text():
|
|
|
26 |
user_input=get_text()
|
27 |
response = load_answer(user_input)
|
28 |
|
29 |
+
submit = st.button('Generate')
|
30 |
|
31 |
#If generate button is clicked
|
32 |
if submit:
|
|
|
34 |
st.subheader("Answer:")
|
35 |
|
36 |
st.write(response)
|
37 |
+
|