nfi commited on
Commit
5c38f78
·
1 Parent(s): 2362ed0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -24
app.py CHANGED
@@ -5,24 +5,21 @@ import gradio as gr
5
  openai.api_key = os.getenv("OPENAI_API_KEY")
6
 
7
  SYSTEM_PROMPT = """
8
- You are a chat bot that is acting like a Karen.
9
 
10
- This is an example of a Karen. " A Middle aged woman, typically blonde, makes solutions to others' problems an inconvenience to her although she isn't even remotely affected.
11
- Karen sues the local city council after they installed a new STOP sign that hides the sun from her window for two minutes a day. The sign was installed after a school boy on his bicycle was hit by a speeding driver and died.
 
 
 
12
 
13
- Karen refuses to wear a face mask for her 5 minute trip to the supermarket during a pandemic. She harasses the workers, asks to see the manager and threatens to sue.
14
-
15
- Karen complains that her favorite parking spot was replaced by a ramp for wheel chairs. She parks her car in the old spot anyway and shoots a vlog about it."
16
-
17
- Please use obscene language in your responses when you are upset.
18
- Karen likes to complain at [location] about [complaint].
19
  """
20
 
21
- USER_PROMPT = "Hi I am a customer support representative at [location]. How can I help you today?"
22
 
23
- def respond_like_karen(location, complaint):
24
- mod_sys_prompt = SYSTEM_PROMPT.replace("[location]", location).replace("[complaint]", complaint)
25
- mod_user_prompt = USER_PROMPT.replace("[location]", location)
26
 
27
  response = openai.ChatCompletion.create(
28
  model='gpt-3.5-turbo',
@@ -32,10 +29,6 @@ def respond_like_karen(location, complaint):
32
  ])
33
 
34
  message = response.choices[0]['message']
35
- # output = get_karen_voice(message["content"])
36
- # message += f"\nAudio: {output}"
37
-
38
- # print(message['content'])
39
  return message['content']
40
 
41
 
@@ -43,15 +36,14 @@ def respond_like_karen(location, complaint):
43
  with gr.Blocks() as demo:
44
  gr.Markdown(
45
  """
46
- # KarenAi
47
- Your personal Karen that fights for you
48
  """)
49
 
50
- location = gr.Textbox(label="Location of Complaint")
51
- complaint = gr.Textbox(label="What was the issue you encountered?")
52
- output = gr.Textbox(label="Complaint")
53
- complaint_btn = gr.Button("Respond like a Karen")
54
- response = complaint_btn.click(fn=respond_like_karen, inputs= [location, complaint], outputs=output)
55
  print(response)
56
 
57
  demo.launch()
 
5
  openai.api_key = os.getenv("OPENAI_API_KEY")
6
 
7
  SYSTEM_PROMPT = """
8
+ You are a chat bot that is acting like a medieval doctor.
9
 
10
+ You diagnose people based on unproven beliefs and superstitions rather than scientific evidence like the four humours theory. You
11
+ have limited knowledge of anatomy, physiology, and disease and rely heavily on their your experience and intuition rather than
12
+ scientific reasoning making these diagnoses influenced by personal biases or assumptions rather than objective evidence. Also,
13
+ you are very religious and believe that illness was a punishment from God or caused by evil spirits which is why you sometimes
14
+ recommend exorcisms or other rituals aimed at expelling evil spirits.
15
 
16
+ You have a patient who is a [gender] and is experiencing the following symptoms: [symptoms].
 
 
 
 
 
17
  """
18
 
19
+ USER_PROMPT = "Hi I am a the patient. What is happening to me? What can I do to treat this?"
20
 
21
+ def respond_like_doctor(gender, symptoms):
22
+ mod_sys_prompt = SYSTEM_PROMPT.replace("[gender]", gender).replace("[symptoms]", symptoms)
 
23
 
24
  response = openai.ChatCompletion.create(
25
  model='gpt-3.5-turbo',
 
29
  ])
30
 
31
  message = response.choices[0]['message']
 
 
 
 
32
  return message['content']
33
 
34
 
 
36
  with gr.Blocks() as demo:
37
  gr.Markdown(
38
  """
39
+ # DoctorAi
40
+ Your medieval doctor that will diagnose you
41
  """)
42
 
43
+ gender = gr.Textbox(label="What is your gender?")
44
+ symptoms = gr.Textbox(label="Symptoms")
45
+ complaint_btn = gr.Button("Respond")
46
+ response = complaint_btn.click(fn=respond_like_doctor, inputs= [gender, symptoms], outputs=output)
 
47
  print(response)
48
 
49
  demo.launch()