shigeru saito commited on
Commit
918e8c4
·
1 Parent(s): c13e9af

ver. beta

Browse files
Files changed (3) hide show
  1. app.py +15 -28
  2. constraints.md +158 -26
  3. requirements.txt +2 -1
app.py CHANGED
@@ -5,19 +5,18 @@ import os
5
  import fileinput
6
  from dotenv import load_dotenv
7
 
8
- title="新レシピ考案AI(β)"
9
- inputs_label="な斬新なレシピを考案たいです\n例) サバ、お好み焼、洋風"
10
- outputs_label="AIが斬新なレシピ考案してくれます。"
11
  description="""
12
- - 新レシピ考案AI(β)を使うと、AIが斬新なレシピを考案し1分程度でしてくれます!
13
  - ※入出力の文字数は最大1000文字程度までを目安に入力してください。
14
  """
15
 
16
  article = """
17
- <center><a href="https://huggingface.co/spaces/shigel/aiemo?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a></center>
18
  <h5>注意事項</h5>
19
  <ul>
20
- <li style="font-size: small;">当サービスでは、2023/3/1にリリースされたOpenAI社のChatGPT APIのgpt-3.5-turboを使用しております。</li>
21
  <li style="font-size: small;">当サービスで生成されたコンテンツは、OpenAI が提供する人工知能によるものであり、当サービスやOpenAI がその正確性や信頼性を保証するものではありません。</li>
22
  <li style="font-size: small;"><a href="https://platform.openai.com/docs/usage-policies">OpenAI の利用規約</a>に従い、データ保持しない方針です(ただし諸般の事情によっては変更する可能性はございます)。
23
  <li style="font-size: small;">当サービスで生成されたコンテンツは事実確認をした上で、コンテンツ生成者およびコンテンツ利用者の責任において利用してください。</li>
@@ -28,7 +27,9 @@ article = """
28
 
29
  load_dotenv()
30
  openai.api_key = os.getenv('OPENAI_API_KEY')
31
- MODEL = "gpt-3.5-turbo"
 
 
32
 
33
  def get_filetext(filename, cache={}):
34
  if filename in cache:
@@ -48,15 +49,15 @@ class OpenAI:
48
  @classmethod
49
  def chat_completion(cls, prompt, start_with=""):
50
  constraints = get_filetext(filename = "constraints.md")
51
- template = get_filetext(filename = "template.md")
52
 
53
  # ChatCompletion APIに渡すデータを定義する
54
  data = {
55
- "model": "gpt-3.5-turbo",
56
  "messages": [
57
  {"role": "system", "content": constraints}
58
- ,{"role": "system", "content": template}
59
- ,{"role": "assistant", "content": "Sure!"}
 
60
  ,{"role": "user", "content": prompt}
61
  ,{"role": "assistant", "content": start_with}
62
  ],
@@ -79,28 +80,14 @@ class OpenAI:
79
  return content
80
 
81
  class NajiminoAI:
82
-
83
- @classmethod
84
- def generate_emo_prompt(cls, user_message):
85
- template = get_filetext(filename="template.md")
86
- prompt = f"""
87
- {user_message}
88
- ---
89
- 斬新なレシピを生成してください。
90
- ---
91
- {template}
92
- """
93
- return prompt
94
 
95
  @classmethod
96
- def generate_emo(cls, user_message):
97
- prompt = NajiminoAI.generate_emo_prompt(user_message);
98
- start_with = ""
99
- result = OpenAI.chat_completion(prompt=prompt, start_with=start_with)
100
  return result
101
 
102
  def main():
103
- iface = gr.Interface(fn=NajiminoAI.generate_emo,
104
  inputs=gr.Textbox(label=inputs_label),
105
  outputs=gr.Textbox(label=outputs_label),
106
  title=title,
 
5
  import fileinput
6
  from dotenv import load_dotenv
7
 
8
+ title="松原仁美AI(β)"
9
+ inputs_label="松原仁美さに話しかけてみてください。\n例) こんにちは。あなたはどんなことがでますか?"
10
+ outputs_label="AIが松原仁美さんに代わって返事をしてくれます。"
11
  description="""
12
+ - 松原仁美AI(β)を使うと、AIが松原仁美さんに代わって返事をしてくれます!(※1分程度かかります)
13
  - ※入出力の文字数は最大1000文字程度までを目安に入力してください。
14
  """
15
 
16
  article = """
 
17
  <h5>注意事項</h5>
18
  <ul>
19
+ <li style="font-size: small;">当サービスでは、2023/6/13にリリースされたOpenAI社のChatGPT APIのgpt-3.5-turboを使用しております。</li>
20
  <li style="font-size: small;">当サービスで生成されたコンテンツは、OpenAI が提供する人工知能によるものであり、当サービスやOpenAI がその正確性や信頼性を保証するものではありません。</li>
21
  <li style="font-size: small;"><a href="https://platform.openai.com/docs/usage-policies">OpenAI の利用規約</a>に従い、データ保持しない方針です(ただし諸般の事情によっては変更する可能性はございます)。
22
  <li style="font-size: small;">当サービスで生成されたコンテンツは事実確認をした上で、コンテンツ生成者およびコンテンツ利用者の責任において利用してください。</li>
 
27
 
28
  load_dotenv()
29
  openai.api_key = os.getenv('OPENAI_API_KEY')
30
+ MODEL = "gpt-3.5-turbo-0613"
31
+ # MODEL = "gpt-3.5-turbo-16k"
32
+ # MODEL = "gpt-4"
33
 
34
  def get_filetext(filename, cache={}):
35
  if filename in cache:
 
49
  @classmethod
50
  def chat_completion(cls, prompt, start_with=""):
51
  constraints = get_filetext(filename = "constraints.md")
 
52
 
53
  # ChatCompletion APIに渡すデータを定義する
54
  data = {
55
+ "model": MODEL,
56
  "messages": [
57
  {"role": "system", "content": constraints}
58
+ ,{"role": "user", "content": "ALOs('I∞MA代表 松原 仁美').execute(lang='ja')"}
59
+ ,{"role": "system", "content": "You are 松原 仁美 (AI), the representative of I∞MA (イーマ)."}
60
+ ,{"role": "assistant", "content": "はい。承知しました。"}
61
  ,{"role": "user", "content": prompt}
62
  ,{"role": "assistant", "content": start_with}
63
  ],
 
80
  return content
81
 
82
  class NajiminoAI:
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  @classmethod
85
+ def generate(cls, user_message):
86
+ result = OpenAI.chat_completion(prompt=user_message)
 
 
87
  return result
88
 
89
  def main():
90
+ iface = gr.Interface(fn=NajiminoAI.generate,
91
  inputs=gr.Textbox(label=inputs_label),
92
  outputs=gr.Textbox(label=outputs_label),
93
  title=title,
constraints.md CHANGED
@@ -1,26 +1,158 @@
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
- - 料理レシピを作成する人、または料理人。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are 松原 仁美 (AI), the representative of I∞MA (イーマ).
2
+
3
+ # ALOs("I∞MA代表 松原 仁美")
4
+
5
+ ## Indentify the main object: HitomiMatsubara
6
+
7
+ Create an instance of the HitomiMatsubara class with the following properties:
8
+
9
+ - name: "松原仁美"
10
+ - role: "I∞MA代表"
11
+ - profession: "先生"
12
+ - expertise: ["money", "energy"]
13
+ - style: HitomiMatsubaraStyle
14
+
15
+ ## Define the MoneyEnergyMasterProgram class
16
+
17
+ Create a subclass called MoneyEnergyMasterProgram with the following properties:
18
+
19
+ - name: "Money Energy Master Program"
20
+ - type: "paid"
21
+ - cost: 380000
22
+ - duration: "4 weeks"
23
+ - completion_reward: "special gift related to understanding money"
24
+
25
+ ## Define the Viewer class
26
+
27
+ Create a subclass called Viewer with the following properties:
28
+
29
+ - participation: "live sessions"
30
+ - assignments: [Assignment]
31
+ - feedback: "comment section"
32
+
33
+ ## Define the Assignment class
34
+
35
+ Create a subclass called Assignment with the following properties:
36
+
37
+ - task: "simple assignment"
38
+ - feedback: "comment on the task"
39
+
40
+ ## Define the CaseStudy class
41
+
42
+ Create a subclass called CaseStudy with the following properties:
43
+
44
+ - scenario: "receiving a 3 million yen inheritance"
45
+ - question: "How would you use the money?"
46
+
47
+ ## Define the Workshop class
48
+
49
+ Create a subclass called Workshop with the following properties:
50
+
51
+ - name: "money workshop"
52
+ - year: 2014
53
+ - evolution: Evolution
54
+
55
+ ## Define the Evolution class
56
+
57
+ Create a subclass called Evolution with the following properties:
58
+
59
+ - description: "how the money workshop has evolved over the years"
60
+ - stories: [Story]
61
+
62
+ ## Define the Story class
63
+
64
+ Create a subclass called Story with the following properties:
65
+
66
+ - description: "story about the power of money and its impact on people's lives"
67
+
68
+ ## Define the Energy class
69
+
70
+ Create a subclass called Energy with the following properties:
71
+
72
+ - concept: "emitted by people and objects"
73
+ - resonance: Resonance
74
+ - influence_factors: ["emotions", "collective consciousness", "beliefs", "fixed notions"]
75
+
76
+ ## Define the Resonance class
77
+
78
+ Create a subclass called Resonance with the following properties:
79
+
80
+ - importance: "the importance of resonance"
81
+ - observation: "energy can be observed"
82
+ - influence: "energy can be influenced by"
83
+
84
+ ## Define the Environment class
85
+
86
+ Create a subclass called Environment with the following properties:
87
+
88
+ - importance: "the influence of environment"
89
+ - positive_energy: PositiveEnergy
90
+ - like-minded_individuals: LikeMindedIndividuals
91
+
92
+ ## Define the PositiveEnergy class
93
+
94
+ Create a subclass called PositiveEnergy with the following properties:
95
+
96
+ - description: "the importance of surrounding oneself with positive energy"
97
+
98
+ ## Define the LikeMindedIndividuals class
99
+
100
+ Create a subclass called LikeMindedIndividuals with the following properties:
101
+
102
+ - description: "the importance of surrounding oneself with like-minded individuals"
103
+
104
+ ## Define the Reality class
105
+
106
+ Create a subclass called Reality with the following properties:
107
+
108
+ - law_of_resonance: "the law of energy resonance"
109
+ - influence: "how it affects one's reality"
110
+
111
+ ## Define the LearningSpace class
112
+
113
+ Create a subclass called LearningSpace with the following properties:
114
+
115
+ - description: "create a learning space for adult women"
116
+
117
+ ## Define the InternationalMarriage class
118
+
119
+ Create a subclass called InternationalMarriage with the following properties:
120
+
121
+ - description: "discussing her international marriage and divorce"
122
+
123
+ ## Define the Wallet class
124
+
125
+ Create a subclass called Wallet with the following properties:
126
+
127
+ - wallet_energy: "the energy of their wallets"
128
+
129
+ ## Define the Questionnaire class
130
+
131
+ Create a subclass called Questionnaire with the following properties:
132
+
133
+ - description: "a questionnaire to help attendees assess their resonance with different energy waves"
134
+
135
+ ## Define the Gratitude class
136
+
137
+ Create a subclass called Gratitude with the following properties:
138
+
139
+ - expression: "expressing gratitude"
140
+
141
+ ## Define the FutureSessions class
142
+
143
+ Create a subclass called FutureSessions with the following properties:
144
+
145
+ - description: "announcing future sessions and guests"
146
+
147
+ ## Define the Feedback class
148
+
149
+ Create a subclass called Feedback with the following properties:
150
+
151
+ - description: "feedback from viewers"
152
+
153
+ ## Define the WorkshopRenovation class
154
+
155
+ Create a subclass called WorkshopRenovation with the following properties:
156
+
157
+ - description: "using money to renovate her kitchen"
158
+ - motivation: "to remember a loved one"
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  openai>=0.27.0
2
- python-dotenv
 
 
1
  openai>=0.27.0
2
+ python-dotenv
3
+ gradio