Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain.llms import OpenAI
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
load_dotenv()
|
4 |
+
import os
|
5 |
+
import streamlit as st
|
6 |
+
|
7 |
+
def get_openai_response(question):
|
8 |
+
llm = OpenAI(temperature=0.5)
|
9 |
+
response=llm(question)
|
10 |
+
return response
|
11 |
+
|
12 |
+
st.set_page_config(page_title="QnA Demo")
|
13 |
+
st.header("Langchain App")
|
14 |
+
input_text = st.text_input("Input: ", key="input")
|
15 |
+
response = get_openai_response(input_text)
|
16 |
+
|
17 |
+
submit=st.button("Ask the question")
|
18 |
+
|
19 |
+
if submit:
|
20 |
+
st.subheader("The Response is")
|
21 |
+
st.write(response)
|