Spaces:
Sleeping
Sleeping
Base files
Browse files- .env-sample +0 -0
- app.py +22 -0
- requirements.txt +1 -0
.env-sample
ADDED
|
File without changes
|
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
def load_answer(question):
|
| 4 |
+
llm=OpenAI(model_name="text-davinci-003", temperature=0)
|
| 5 |
+
answer=llm(question)
|
| 6 |
+
return answer
|
| 7 |
+
|
| 8 |
+
def get_text(): #from the UI App
|
| 9 |
+
input_text = st.text_input("Enter a question: ", key="input")
|
| 10 |
+
return input_text
|
| 11 |
+
|
| 12 |
+
#UIApp starts here
|
| 13 |
+
st.set_page_config(page_title="LangChain Demo - Simple Question Answering App", page_icon=":robot:")
|
| 14 |
+
st.header("Simple Question Answering App")
|
| 15 |
+
|
| 16 |
+
user_input=get_text()
|
| 17 |
+
response=load_answer(user_input)
|
| 18 |
+
|
| 19 |
+
submit=st.button('Generate')
|
| 20 |
+
if submit:
|
| 21 |
+
st.subheader("Answer: ")
|
| 22 |
+
st.write(response)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Streamlit
|