A-Jyothi-11
commited on
Commit
•
02c8cc8
1
Parent(s):
7273fd7
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_community.llms import OpenAI
|
2 |
+
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
|
5 |
+
load_dotenv()
|
6 |
+
|
7 |
+
import streamlit as st
|
8 |
+
import os
|
9 |
+
def get_openai_response(question):
|
10 |
+
llm=OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"),temperature=0.5)
|
11 |
+
return llm.predict(question)
|
12 |
+
|
13 |
+
st.set_page_config(page_title="Q&A Demo")
|
14 |
+
|
15 |
+
st.header("Langchain Application")
|
16 |
+
|
17 |
+
input=st.text_input("Input: ",key="input")
|
18 |
+
response=get_openai_response(input)
|
19 |
+
|
20 |
+
submit=st.button("Ask the question")
|
21 |
+
|
22 |
+
if submit:
|
23 |
+
st.subheader("The Response is")
|
24 |
+
st.write(response)
|
25 |
+
|