Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -891,17 +891,17 @@ def init_openai_api_key(api_key=""):
|
|
| 891 |
global gpt_state
|
| 892 |
gpt_state=1
|
| 893 |
# return [gr.update(visible=True)]+[gr.update(visible=False)]+[gr.update(visible=True)]*3+[gr.update(visible=False)]+ [gr.update(visible=False)]*3 + [text_refiner, visual_chatgpt, None]+[gr.update(visible=True)]*3
|
| 894 |
-
return [gr.update(visible=True)]+[gr.update(visible=False)]+[gr.update(visible=True)]* 3 + [gr.update(visible=False)]*3 + [text_refiner, visual_chatgpt, None]+[gr.update(visible=True)]*4+[gr.update(visible=False)]
|
| 895 |
else:
|
| 896 |
gpt_state=0
|
| 897 |
# return [gr.update(visible=False)]*7 + [gr.update(visible=True)]*2 + [text_refiner, visual_chatgpt, 'Your OpenAI API Key is not available']+[gr.update(visible=False)]*3
|
| 898 |
-
return [gr.update(visible=False)]*6 + [gr.update(visible=True)]*2 + [text_refiner, visual_chatgpt, 'Your OpenAI API Key is not available']+[gr.update(visible=False)]*
|
| 899 |
|
| 900 |
def init_wo_openai_api_key():
|
| 901 |
global gpt_state
|
| 902 |
gpt_state=0
|
| 903 |
# return [gr.update(visible=False)]*4 + [gr.update(visible=True)]+ [gr.update(visible=False)]+[gr.update(visible=True)]+[gr.update(visible=False)]*2 + [None, None, None]+[gr.update(visible=False)]*3
|
| 904 |
-
return [gr.update(visible=False)]*4 + [gr.update(visible=True)]+ [gr.update(visible=False)]+[gr.update(visible=True)]+[gr.update(visible=False)]*2 + [None, None, None]+[gr.update(visible=False)]
|
| 905 |
|
| 906 |
|
| 907 |
def get_click_prompt(chat_input, click_state, click_mode):
|
|
@@ -2145,12 +2145,13 @@ def create_ui():
|
|
| 2145 |
# show_share_button=True,
|
| 2146 |
# show_download_button=True
|
| 2147 |
)
|
| 2148 |
-
with gr.Column(scale=3):
|
| 2149 |
selected_image = gr.Image(label="Selected Image", interactive=False)
|
| 2150 |
|
| 2151 |
sort_rec = gr.Radio(
|
| 2152 |
choices=[1,2,3,4,5,6,7],
|
| 2153 |
label="Score",
|
|
|
|
| 2154 |
interactive=True,info="Please sort the recommendation artwork")
|
| 2155 |
|
| 2156 |
recommend_type = gr.Radio(
|
|
@@ -2523,11 +2524,11 @@ def create_ui():
|
|
| 2523 |
|
| 2524 |
openai_api_key.submit(init_openai_api_key, inputs=[openai_api_key],
|
| 2525 |
outputs=[export, modules_need_gpt1, modules_need_gpt3, modules_not_need_gpt,
|
| 2526 |
-
modules_not_need_gpt2, tts_interface, module_key_input ,module_notification_box, text_refiner, visual_chatgpt, notification_box,top_row,recommend,reco_reasons,instruct,modules_not_need_gpt3])
|
| 2527 |
enable_chatGPT_button.click(init_openai_api_key, inputs=[openai_api_key],
|
| 2528 |
outputs=[export,modules_need_gpt1, modules_need_gpt3,
|
| 2529 |
modules_not_need_gpt,
|
| 2530 |
-
modules_not_need_gpt2, tts_interface,module_key_input,module_notification_box, text_refiner, visual_chatgpt, notification_box,top_row,recommend,reco_reasons,instruct,modules_not_need_gpt3])
|
| 2531 |
|
| 2532 |
# disable_chatGPT_button.click(init_wo_openai_api_key,
|
| 2533 |
# outputs=[export,modules_need_gpt1, modules_need_gpt3,
|
|
|
|
| 891 |
global gpt_state
|
| 892 |
gpt_state=1
|
| 893 |
# return [gr.update(visible=True)]+[gr.update(visible=False)]+[gr.update(visible=True)]*3+[gr.update(visible=False)]+ [gr.update(visible=False)]*3 + [text_refiner, visual_chatgpt, None]+[gr.update(visible=True)]*3
|
| 894 |
+
return [gr.update(visible=True)]+[gr.update(visible=False)]+[gr.update(visible=True)]* 3 + [gr.update(visible=False)]*3 + [text_refiner, visual_chatgpt, None]+[gr.update(visible=True)]*4+[gr.update(visible=False)]+[gr.update(visible=True)]*2
|
| 895 |
else:
|
| 896 |
gpt_state=0
|
| 897 |
# return [gr.update(visible=False)]*7 + [gr.update(visible=True)]*2 + [text_refiner, visual_chatgpt, 'Your OpenAI API Key is not available']+[gr.update(visible=False)]*3
|
| 898 |
+
return [gr.update(visible=False)]*6 + [gr.update(visible=True)]*2 + [text_refiner, visual_chatgpt, 'Your OpenAI API Key is not available']+[gr.update(visible=False)]*7
|
| 899 |
|
| 900 |
def init_wo_openai_api_key():
|
| 901 |
global gpt_state
|
| 902 |
gpt_state=0
|
| 903 |
# return [gr.update(visible=False)]*4 + [gr.update(visible=True)]+ [gr.update(visible=False)]+[gr.update(visible=True)]+[gr.update(visible=False)]*2 + [None, None, None]+[gr.update(visible=False)]*3
|
| 904 |
+
return [gr.update(visible=False)]*4 + [gr.update(visible=True)]+ [gr.update(visible=False)]+[gr.update(visible=True)]+[gr.update(visible=False)]*2 + [None, None, None]+[gr.update(visible=False)]*3
|
| 905 |
|
| 906 |
|
| 907 |
def get_click_prompt(chat_input, click_state, click_mode):
|
|
|
|
| 2145 |
# show_share_button=True,
|
| 2146 |
# show_download_button=True
|
| 2147 |
)
|
| 2148 |
+
with gr.Column(scale=3,visible=False) as reco_preview:
|
| 2149 |
selected_image = gr.Image(label="Selected Image", interactive=False)
|
| 2150 |
|
| 2151 |
sort_rec = gr.Radio(
|
| 2152 |
choices=[1,2,3,4,5,6,7],
|
| 2153 |
label="Score",
|
| 2154 |
+
visible=False,
|
| 2155 |
interactive=True,info="Please sort the recommendation artwork")
|
| 2156 |
|
| 2157 |
recommend_type = gr.Radio(
|
|
|
|
| 2524 |
|
| 2525 |
openai_api_key.submit(init_openai_api_key, inputs=[openai_api_key],
|
| 2526 |
outputs=[export, modules_need_gpt1, modules_need_gpt3, modules_not_need_gpt,
|
| 2527 |
+
modules_not_need_gpt2, tts_interface, module_key_input ,module_notification_box, text_refiner, visual_chatgpt, notification_box,top_row,recommend,reco_reasons,instruct,modules_not_need_gpt3,sort_rec,reco_preview])
|
| 2528 |
enable_chatGPT_button.click(init_openai_api_key, inputs=[openai_api_key],
|
| 2529 |
outputs=[export,modules_need_gpt1, modules_need_gpt3,
|
| 2530 |
modules_not_need_gpt,
|
| 2531 |
+
modules_not_need_gpt2, tts_interface,module_key_input,module_notification_box, text_refiner, visual_chatgpt, notification_box,top_row,recommend,reco_reasons,instruct,modules_not_need_gpt3,sort_rec,reco_preview])
|
| 2532 |
|
| 2533 |
# disable_chatGPT_button.click(init_wo_openai_api_key,
|
| 2534 |
# outputs=[export,modules_need_gpt1, modules_need_gpt3,
|