Lokesh Lal Majhi commited on
Commit
3beaf84
·
1 Parent(s): d65c833

Create Pilgr-image bot

Browse files
Files changed (1) hide show
  1. Pilgr-image bot +17 -0
Pilgr-image bot ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pip install gradio
2
+ pip install openai
3
+ import openai
4
+ import gradio
5
+ openai.api_key = "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"
6
+ messages = [{"role": "system", "content": "You are a Pilgrimage Expert"}]
7
+ def CustomChatGPT(user_input):
8
+ messages.append({"role": "user", "content": user_input})
9
+ response = openai.ChatCompletion.create(
10
+ model = "gpt-3.5-turbo",
11
+ messages = messages
12
+ )
13
+ ChatGPT_reply = response["choices"][0]["message"]["content"]
14
+ messages.append({"role": "assistant", "content": ChatGPT_reply})
15
+ return ChatGPT_reply
16
+ demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "Your Pilgr-image Bot")
17
+ demo.launch(share=True)