Commit
•
f3efff2
1
Parent(s):
81667a5
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ article = """
|
|
30 |
|
31 |
load_dotenv()
|
32 |
openai.api_key = os.getenv('OPENAI_API_KEY')
|
33 |
-
MODEL = "gpt
|
34 |
|
35 |
def get_filetext(filename, cache={}):
|
36 |
if filename in cache:
|
@@ -80,10 +80,10 @@ class OpenAI:
|
|
80 |
content = result["choices"][0]["message"]["content"].strip()
|
81 |
return content
|
82 |
|
83 |
-
class
|
84 |
|
85 |
@classmethod
|
86 |
-
def
|
87 |
template = get_filetext(filename="template.md")
|
88 |
prompt = f"""
|
89 |
{user_message}
|
@@ -95,14 +95,14 @@ class NajiminoAI:
|
|
95 |
return prompt
|
96 |
|
97 |
@classmethod
|
98 |
-
def
|
99 |
-
prompt =
|
100 |
start_with = ""
|
101 |
result = OpenAI.chat_completion(prompt=prompt, start_with=start_with)
|
102 |
return result
|
103 |
|
104 |
def main():
|
105 |
-
iface = gr.Interface(fn=
|
106 |
inputs=gr.Textbox(label=inputs_label),
|
107 |
outputs=gr.Textbox(label=outputs_label),
|
108 |
title=title,
|
|
|
30 |
|
31 |
load_dotenv()
|
32 |
openai.api_key = os.getenv('OPENAI_API_KEY')
|
33 |
+
MODEL = "gpt-4"
|
34 |
|
35 |
def get_filetext(filename, cache={}):
|
36 |
if filename in cache:
|
|
|
80 |
content = result["choices"][0]["message"]["content"].strip()
|
81 |
return content
|
82 |
|
83 |
+
class MasasanAI:
|
84 |
|
85 |
@classmethod
|
86 |
+
def generate_plan_prompt(cls, user_message):
|
87 |
template = get_filetext(filename="template.md")
|
88 |
prompt = f"""
|
89 |
{user_message}
|
|
|
95 |
return prompt
|
96 |
|
97 |
@classmethod
|
98 |
+
def generate_plan(cls, user_message):
|
99 |
+
prompt = MasasanAI.generate_plan_prompt(user_message);
|
100 |
start_with = ""
|
101 |
result = OpenAI.chat_completion(prompt=prompt, start_with=start_with)
|
102 |
return result
|
103 |
|
104 |
def main():
|
105 |
+
iface = gr.Interface(fn=MasasanAI.generate_plan,
|
106 |
inputs=gr.Textbox(label=inputs_label),
|
107 |
outputs=gr.Textbox(label=outputs_label),
|
108 |
title=title,
|