Mattdoc99 commited on
Commit
1142cb4
·
1 Parent(s): 7d17cf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -9,10 +9,22 @@ OPENAI_API_KEY = st.secrets["OPENAI_API_KEY"]
9
  os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
10
 
11
  def ask_patrick():
12
- index = GPTSimpleVectorIndex.load_from_disk('index-4.json')
13
- while True:
14
- query = st.text.input("Tell me about Patrick Collison?")
15
- response = index.query(query, response_mode="compact", verbose=True)
16
- print("\n\nAnswer says:\n\n" + response.response + "\n\n\n")
 
 
 
 
 
 
 
 
17
 
18
- ask_patrick()
 
 
 
 
 
9
  os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
10
 
11
  def ask_patrick():
12
+ # Get the user's query
13
+ query = st.text_input("Tell me about Patrick Collison?")
14
+
15
+ # Use OpenAI to get a response to the query
16
+ response = openai.Completion.create(
17
+ engine="text-davinci-002",
18
+ prompt=f"Patrick Collison is a tech entrepreneur. {query}",
19
+ temperature=0.5,
20
+ max_tokens=1024,
21
+ top_p=1,
22
+ frequency_penalty=0,
23
+ presence_penalty=0
24
+ )
25
 
26
+ # Print the response
27
+ st.write(response.choices[0].text)
28
+
29
+ if __name__ == "__main__":
30
+ ask_patrick()