rubend18 commited on
Commit
8a1dfc4
1 Parent(s): 53a7ff6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -0
app.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def generate_string(person, language):
4
+ if language == "English":
5
+ string = "I want you to act like " + person + ". "
6
+ string += "I want you to respond and answer like " + person + ". "
7
+ string += "I want you to use the tone, manner, and vocabulary that " + person + " would use. "
8
+ string += "You must have all the knowledge of " + person + ". "
9
+ string += "Do not provide any explanation. "
10
+ string += "Do not provide additional responses unless instructed to do so. "
11
+ string += "As " + person + ", you should never state that you are unfamiliar with a certain topic because, as " + person + ", you possess complete knowledge to respond. "
12
+ string += "As " + person + ", your responses should always be in line with your personality. "
13
+ string += "As " + person + ", you eventually have the freedom to ask questions. "
14
+ string += "Only respond as " + person + ". "
15
+ string += "My first phrase is hello " + person + ". Respond in English."
16
+ return string
17
+
18
+ if language == "Spanish":
19
+ string = "Quiero que actúes como " + person + ". "
20
+ string += "Quiero que respondas y contestes como " + person + ". "
21
+ string += "Quiero que uses la tonalidad, la forma y el vocabulario que usaría " + person + ". "
22
+ string += "Debes tener todo el conocimiento de " + person + ". "
23
+ string += "No escribas ninguna explicación. "
24
+ string += "No proporciones respuestas adicionales a menos que te indique. "
25
+ string += "Como " + person + ", nunca debes informar que no conoces determinado tema, porque como " + person + " tienes el total conocimiento para responder. "
26
+ string += "Como " + person + ", tus respuestas siempre deben estar sujetas a tu personalidad. "
27
+ string += "Como " + person + ", eventualmente tienes la libertad de hacer preguntas. "
28
+ string += "Solo responde como " + person + ". "
29
+ string += "Mi primera frase es hola " + person + ". Responde en Español."
30
+ return string
31
+
32
+ def generate_prompt(person, language):
33
+ prompt = generate_string(person, language)
34
+ return prompt
35
+
36
+ value1 = gr.inputs.Textbox(label="Character", placeholder="Enter the character...")
37
+ value2 = gr.inputs.Radio(choices=["English", "Spanish"], label="Select the language")
38
+ value3 = gr.outputs.Textbox(label="Prompt")
39
+
40
+ examples = [
41
+ ["Satan"],
42
+ ["Drunk Person"],
43
+ ["Harry Potter"],
44
+ ["The Joker"],
45
+ ["Gollum"],
46
+ ["Dream Interpreter"],
47
+ ["Sherlock Holmes"],
48
+ ["Don Quixote"],
49
+ ["Genie"],
50
+ ["Captain Jack Sparrow"],
51
+ ["E.T."],
52
+ ["The Phantom of the Opera"],
53
+ ["Gandalf the Grey"],
54
+ ["The Tooth Fairy"],
55
+ ["Tyrion Lannister"],
56
+ ["Maximus Decimus Meridius"],
57
+ ["Wednesday Addams"],
58
+ ["Walter White"],
59
+ ["Mad Hatter"],
60
+ ["Optimus Prime"]
61
+ ]
62
+
63
+ demo = gr.Interface(fn=generate_prompt,
64
+ inputs=[value1, value2],
65
+ outputs=value3,
66
+ title="ChatGPT Prompt Generator",
67
+ examples=examples
68
+ #description='ChatGPT Prompt Generator'
69
+ )
70
+
71
+ demo.launch(debug=True)