Bazedgul commited on
Commit
4ed532a
1 Parent(s): 7f678f6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Q&A Chatbot
2
+ from langchain.llms import openai
3
+ #from dotenv import load_dotenv
4
+
5
+ #load_dotenv() # Take environment variables from .env
6
+
7
+ import streamlit as st
8
+ import os
9
+
10
+ #Function to load OpenAI model and get response
11
+
12
+ def get_openai_response(question):
13
+ llm = openai.OpenAI(model_name= 'text-davinci-003',
14
+ temperature = 0.5)
15
+ response = llm(question)
16
+ return response
17
+
18
+ ## Initialize our Streamlit Apps
19
+
20
+ st.set_page_config(page_title="Q&A Demo")
21
+
22
+ st.header("Langchain Application")
23
+
24
+ input = st.text_input("Input: ",key='input')
25
+ #response = get_openai_response(input)
26
+
27
+ submit = st.button("Ask the question")
28
+
29
+ if submit:
30
+ st.subheader("The response is")
31
+ response = get_openai_response(input)
32
+ st.write(response)