Spaces:
Sleeping
Sleeping
IS_ENV_LOCAL = os.getenv("IS_ENV_LOCAL", False)
Browse files
app.py
CHANGED
|
@@ -5,9 +5,9 @@ from openai import OpenAI
|
|
| 5 |
import json
|
| 6 |
|
| 7 |
# 設置 OpenAI API 客戶端
|
| 8 |
-
|
| 9 |
|
| 10 |
-
if
|
| 11 |
local_json = json.load(open("local.json"))
|
| 12 |
openai_api_key = local_json["OPENAI_API_KEY"]
|
| 13 |
else:
|
|
@@ -123,20 +123,21 @@ with gr.Blocks() as demo:
|
|
| 123 |
base_chars_input = gr.Textbox(label="Base Characters")
|
| 124 |
|
| 125 |
with gr.Row():
|
| 126 |
-
with gr.Row():
|
| 127 |
-
|
|
|
|
| 128 |
generate_button1 = gr.Button("Generate Article - gpt-4-0125-preview")
|
| 129 |
with gr.Row():
|
| 130 |
output_text1 = gr.Textbox(label="Generated Article - gpt-4-0125-preview")
|
| 131 |
with gr.Row():
|
| 132 |
with gr.Row():
|
| 133 |
-
model_2 = gr.
|
| 134 |
generate_button2 = gr.Button("Generate Article - gpt-3.5-turbo")
|
| 135 |
with gr.Row():
|
| 136 |
output_text2 = gr.Textbox(label="Generated Article - gpt-3.5-turbo")
|
| 137 |
with gr.Row():
|
| 138 |
with gr.Row():
|
| 139 |
-
model_3 = gr.
|
| 140 |
generate_button3 = gr.Button("Generate Article - gpt-4")
|
| 141 |
with gr.Row():
|
| 142 |
output_text3 = gr.Textbox(label="Generated Article - gpt-4")
|
|
|
|
| 5 |
import json
|
| 6 |
|
| 7 |
# 設置 OpenAI API 客戶端
|
| 8 |
+
IS_ENV_LOCAL = os.getenv("IS_ENV_LOCAL", False)
|
| 9 |
|
| 10 |
+
if IS_ENV_LOCAL:
|
| 11 |
local_json = json.load(open("local.json"))
|
| 12 |
openai_api_key = local_json["OPENAI_API_KEY"]
|
| 13 |
else:
|
|
|
|
| 123 |
base_chars_input = gr.Textbox(label="Base Characters")
|
| 124 |
|
| 125 |
with gr.Row():
|
| 126 |
+
with gr.Row():
|
| 127 |
+
model_list = ["gpt-4-0125-preview", "gpt-3.5-turbo", "gpt-4"]
|
| 128 |
+
model_1 = gr.Dropdown(label="Model 1", choices=model_list, value="gpt-4-0125-preview")
|
| 129 |
generate_button1 = gr.Button("Generate Article - gpt-4-0125-preview")
|
| 130 |
with gr.Row():
|
| 131 |
output_text1 = gr.Textbox(label="Generated Article - gpt-4-0125-preview")
|
| 132 |
with gr.Row():
|
| 133 |
with gr.Row():
|
| 134 |
+
model_2 = gr.Dropdown(label="Model 2", choices=model_list, value="gpt-3.5-turbo")
|
| 135 |
generate_button2 = gr.Button("Generate Article - gpt-3.5-turbo")
|
| 136 |
with gr.Row():
|
| 137 |
output_text2 = gr.Textbox(label="Generated Article - gpt-3.5-turbo")
|
| 138 |
with gr.Row():
|
| 139 |
with gr.Row():
|
| 140 |
+
model_3 = gr.Dropdown(label="Model 3", choices=model_list, value="gpt-4")
|
| 141 |
generate_button3 = gr.Button("Generate Article - gpt-4")
|
| 142 |
with gr.Row():
|
| 143 |
output_text3 = gr.Textbox(label="Generated Article - gpt-4")
|