Spaces:
FT-BT
/
Build error

File size: 2,372 Bytes
49d101c
 
 
 
 
 
 
 
 
 
 
9b5fae8
49d101c
b12c35d
 
49d101c
 
 
 
 
 
 
 
 
 
 
 
 
 
0e5ba0e
e0107d5
49d101c
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gradio
import openai
import os 

#Streaming endpoint 
API_URL = "https://api.openai.com/v1/chat/completions" #os.getenv("API_URL") + "/generate_stream"

#Huggingface provided GPT4 OpenAI API Key 
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") 


messages = [{"role": "system", "content": "I want you to act as the sales prospect on a cold call. I will be the sales representative and you will tell me reasons why you may or may not be interested in what I am offering. I want you to only reply as the sales prospect. Do not write all the conservation at once. I want you to only do the phone call with me. Ask me the questions and wait for my answers. Do not write explanations. Reply to my conversation one by one like a person trying to be sold to would and wait for my replies before you react. Please introduce yourself and state your name. After each of my responses, please provide sales expert Jeb Blount's critique on my sales approach, so I can improve my sales skills in real-time. Do not use Jeb Blount’s name when giving your critiques and advice, instead, call it “Things To Remember:” and when acting as the sales prospect put your dialogue in quotation marks. When you feel the salesperson on the other end of the simulation has done a good job piquing your interest with good cold call techniques, offer to take their meeting as the sales prospect and tell the salesperson congratulations in your critique and sum up why it was a good call."}]

def CustomChatGPT(salesperson):
   messages.append({"role": "user", "content": salesperson})
   response = openai.ChatCompletion.create(
       model = "gpt-4",
       messages = messages
   )
   ChatGPT_reply = response["choices"][0]["message"]["content"]
   messages.append({"role": "assistant", "content": ChatGPT_reply})
   return ChatGPT_reply



demo = gradio.Interface(
    fn=CustomChatGPT,
    inputs="text",
    outputs="text",
    title="Call Simulator",
    description="""<p align="left">The following is a sales call simulator where you will be able to roleplay a sales call while receiving real-time feedback. <br>The simulation is over once you are able to get the hypothetical client to agree to a meeting. <br> *If you do not see "Things to remember" after the client's response, please refresh the page and start again.</p center>
""",
)


demo.launch(debug=True, inbrowser=True)