cybernatedArt commited on
Commit
5e3e01f
1 Parent(s): 670446c

Update script.py

Browse files
Files changed (1) hide show
  1. script.py +15 -2
script.py CHANGED
@@ -1,7 +1,20 @@
1
  import openai
 
2
 
3
  openai.api_key = "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"
4
 
5
- completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Give me 3 ideas for apps I could build with openai apis "}])
6
 
7
- print(completion.choices[0].message.content)
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import openai
2
+ import gradio
3
 
4
  openai.api_key = "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"
5
 
6
+ messages = [{"role": "system", "content": "You are a financial experts that specializes in real estate investment and negotiation"}]
7
 
8
+ def CustomChatGPT(user_input):
9
+ messages.append({"role": "user", "content": user_input})
10
+ response = openai.ChatCompletion.create(
11
+ model = "gpt-3.5-turbo",
12
+ messages = messages
13
+ )
14
+ ChatGPT_reply = response["choices"][0]["message"]["content"]
15
+ messages.append({"role": "assistant", "content": ChatGPT_reply})
16
+ return ChatGPT_reply
17
+
18
+ demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "Real Estate Pro")
19
+
20
+ demo.launch(share=True)