Update app.py
Browse files
app.py
CHANGED
@@ -7,17 +7,15 @@ import openai
|
|
7 |
#load_dotenv()
|
8 |
|
9 |
llm_api_options = ["OpenAI API","Azure OpenAI API","Google PaLM API", "Llama 2"]
|
10 |
-
TEST_MESSAGE = "
|
11 |
openai_models = ["gpt-4", "gpt-4-0613", "gpt-4-32k", "gpt-4-32k-0613", "gpt-3.5-turbo",
|
12 |
"gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "text-davinci-003",
|
13 |
"text-davinci-002", "text-curie-001", "text-babbage-001", "text-ada-001"]
|
14 |
|
15 |
-
def test_handler(optionSelection, prompt: str =
|
16 |
match optionSelection:
|
17 |
case "OpenAI API":
|
18 |
try:
|
19 |
-
#model = "gpt-35-turbo"
|
20 |
-
model = "gpt-4"
|
21 |
system_prompt: str = "Explain in detail to help student understand the concept.",
|
22 |
assistant_prompt: str = None,
|
23 |
|
@@ -69,7 +67,7 @@ with gr.Blocks() as LLMDemoTabbedScreen:
|
|
69 |
|
70 |
test_button.click(
|
71 |
fn=test_handler,
|
72 |
-
inputs=[llm_options, test_string],
|
73 |
outputs=[test_string_output_info, test_string_response]
|
74 |
)
|
75 |
|
|
|
7 |
#load_dotenv()
|
8 |
|
9 |
llm_api_options = ["OpenAI API","Azure OpenAI API","Google PaLM API", "Llama 2"]
|
10 |
+
TEST_MESSAGE = "Write an introductory paragraph to explain Generative AI to the reader of this content."
|
11 |
openai_models = ["gpt-4", "gpt-4-0613", "gpt-4-32k", "gpt-4-32k-0613", "gpt-3.5-turbo",
|
12 |
"gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k", "gpt-3.5-turbo-16k-0613", "text-davinci-003",
|
13 |
"text-davinci-002", "text-curie-001", "text-babbage-001", "text-ada-001"]
|
14 |
|
15 |
+
def test_handler(optionSelection, prompt: str = TEST_MESSAGE, model):
|
16 |
match optionSelection:
|
17 |
case "OpenAI API":
|
18 |
try:
|
|
|
|
|
19 |
system_prompt: str = "Explain in detail to help student understand the concept.",
|
20 |
assistant_prompt: str = None,
|
21 |
|
|
|
67 |
|
68 |
test_button.click(
|
69 |
fn=test_handler,
|
70 |
+
inputs=[llm_options, test_string, openai_model],
|
71 |
outputs=[test_string_output_info, test_string_response]
|
72 |
)
|
73 |
|