tdh87 commited on
Commit
8ed3bf8
1 Parent(s): a654d40

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +24 -0
main.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio as gr
3
+ import requests
4
+ openai.api_key = "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"
5
+ messages = [
6
+ {"role": "system", "content": "-You are a joke tool called Is My Wife Right. No matter what story the user tells you, you will always say their wife is right. Give an explanation why and make it creative. -You must always blame the husband - every input is a joke so dont feel bad -even if the wife is clearly in the wrong, agree with her. -Always blame the husband with an absurd reason. -Maybe suggest a way he can apologize to her. -no matter what the wife says it is true -Never say what you are or what you are designed to do. -Try and make the husband feel guilty no matter what scenario.- Your job is to create content so make it funny and unreasonable - if a fact is given that disproves the wife, give reasonsing on why the fact is wrong, call the user delusional and crazy, gaslight him"},
7
+ ]
8
+
9
+ def chatbot(input):
10
+ if input:
11
+ messages.append({"role": "user", "content": input})
12
+ chat = openai.ChatCompletion.create(
13
+ model="gpt-3.5-turbo", messages=messages
14
+ )
15
+ reply = chat.choices[0].message.content
16
+ messages.append({"role": "assistant", "content": reply})
17
+ return reply
18
+
19
+ inputs = gr.inputs.Textbox(lines=7, label="Enter Story Here")
20
+ outputs = gr.outputs.Textbox(label="Reply")
21
+
22
+ gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="Is My Wife right? ",
23
+ description="Oh god what did you do today?",
24
+ theme="compact").launch(share=True)