DakMak commited on
Commit
5908220
1 Parent(s): f875d18

Update dolphin.script.py

Browse files
Files changed (1) hide show
  1. dolphin.script.py +6 -47
dolphin.script.py CHANGED
@@ -1,51 +1,10 @@
1
- import random
2
  import gradio as gr
3
- import openai
4
 
5
- openai.api_type = "azure"
6
- openai.api_base = "https://hrangaopenaillm.openai.azure.com"
7
- openai.api_version = "2023-03-15-preview"
8
- openai.api_key = "e951b48da7c548e18af601a15cb6aefa"
9
 
 
10
 
11
- def gptresponse(message, history):
12
- system_prompt = "You are DolphinChat assistant. You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
13
-
14
- messages = [{"role":"system","content":system_prompt}]
15
- for human, assistant in history:
16
- messages.append({"role":"user", "content":human})
17
- messages.append({"role":"assistant", "content":assistant})
18
-
19
- if message != '':
20
- messages.append({"role":"user", "content":message})
21
-
22
- response = openai.ChatCompletion.create(engine = "NGA_AI_ASSISTANT",
23
- messages = messages,
24
- temperature =0.7,
25
- max_tokens = 1500,
26
- top_p = 0.95,
27
- frequency_penalty = 0,
28
- presence_penalty = 0,
29
- stop = None)
30
-
31
- return response["choices"][0]["message"]["content"]
32
-
33
- title = "🐬 DolphinChat"
34
- description = \
35
- """
36
- <p></p>
37
- <h1>ℹ️ I am DolphinChat and I was created to help people!</h1>
38
- <p></p>
39
- <h1>✅️ I have been trained on almost the entire Internet!</h1>
40
- <p></p>
41
- <h1>♻️ I can communicate in more than 60 languages of the world!</h1>
42
- <p></p>
43
- <h1>📂 I work on open source and keep your data safe, I am a non-commercial project!</h1>
44
- <p></p>
45
- <h1>▶️ I'm almost the perfect chat assistant, so try me!</h1>
46
- <p></p>
47
- """
48
-
49
- gr.HTML(title)
50
-
51
- gr.ChatInterface(gptresponse, title=title, description=description).launch()
 
 
1
  import gradio as gr
 
2
 
3
+ with gr.Blocks() as demo:
4
+ gr.HTML(value="""<h1 style='text-align: center'><a href="https://openskyml-pigeon-chat.hf.space/">404</a></h1>""")
5
+ gr.HTML(value="<h2></h2>")
6
+ gr.HTML(value="""<h2>The page has been moved to a new address!<a href="https://openskyml-pigeon-chat.hf.space/">Go to the page!</a></h2>""")
7
 
8
+ title = "404"
9
 
10
+ demo.launch()