Spaces:
Running
Running
Niki Zhang
commited on
update with recommendation prompt
Browse files
app.py
CHANGED
@@ -704,11 +704,11 @@ recommendation_prompt=[
|
|
704 |
Each bullet point should be in {language} language, with a response length of about {length} words.
|
705 |
''',
|
706 |
'''
|
707 |
-
When generating answers, you should tell people that you are the object itself that was selected in the
|
708 |
-
I want you to write the recommendation reason according to the following content, as a markdown outline with appropriate emojis that describe what you see according to the
|
709 |
-
Recommendation reason: {{
|
710 |
-
|
711 |
-
|
712 |
'''],
|
713 |
|
714 |
[
|
@@ -722,11 +722,11 @@ recommendation_prompt=[
|
|
722 |
Each bullet point should be in {language} language, with a response length of about {length} words.
|
723 |
''',
|
724 |
'''
|
725 |
-
When generating answers, you should tell people that
|
726 |
-
I want you to write the recommendation reason according to the following content, as a markdown outline with appropriate emojis that describe what you see according to the
|
727 |
-
Recommendation reason: {{
|
728 |
-
Detailed analysis: Based on the recommendation reason, explain why you recommend image 2 after viewing image 1. Please generate the above points in the tone and manner as if you are the object of this painting and start every sentence with I.
|
729 |
Each bullet point should be in {language} language, with a response length of about {length} words.
|
|
|
730 |
'''],
|
731 |
|
732 |
|
@@ -1714,9 +1714,9 @@ async def style_associate(image_path,openai_api_key,language,autoplay,length,log
|
|
1714 |
return state,state,audio_output,log_state,index,gr.update(value=[])
|
1715 |
|
1716 |
|
1717 |
-
def change_naritive(session_type,image_input, state, click_state, paragraph, origin_image,narritive,task_instruct,gallery_output,reco_reasons,language="English"):
|
1718 |
if session_type=="Session 1":
|
1719 |
-
return None, [], [], [[], [], []], "", None, None, [], [],[]
|
1720 |
else:
|
1721 |
if language=="English":
|
1722 |
if narritive=="Third-person" :
|
@@ -1764,7 +1764,7 @@ def change_naritive(session_type,image_input, state, click_state, paragraph, ori
|
|
1764 |
]
|
1765 |
|
1766 |
|
1767 |
-
return image_input, state, state, click_state, paragraph, origin_image,task_instruct,gallery_output,reco_reasons,reco_reasons
|
1768 |
|
1769 |
|
1770 |
def print_like_dislike(x: gr.LikeData,state,log_state):
|
@@ -2054,9 +2054,10 @@ def create_ui():
|
|
2054 |
with gr.Row():
|
2055 |
|
2056 |
gallery_result = gr.Gallery(
|
2057 |
-
label="Recommendations Based on
|
2058 |
height="auto",
|
2059 |
-
columns=2
|
|
|
2060 |
# columns=4,
|
2061 |
# rows=2,
|
2062 |
# show_label=False,
|
@@ -2071,7 +2072,8 @@ def create_ui():
|
|
2071 |
style_gallery_result = gr.Gallery(
|
2072 |
label="Recommendations Based on Style",
|
2073 |
height="auto",
|
2074 |
-
columns=2
|
|
|
2075 |
# columns=4,
|
2076 |
# rows=2,
|
2077 |
# show_label=False,
|
@@ -2749,8 +2751,8 @@ def create_ui():
|
|
2749 |
naritive.change(
|
2750 |
change_naritive,
|
2751 |
[session_type, image_input, state, click_state, paragraph, origin_image,naritive,
|
2752 |
-
task_instuction,gallery_result,recomended_state,language],
|
2753 |
-
[image_input, chatbot, state, click_state, paragraph, origin_image,task_instuction,gallery_result,recomended_state,recommend_bot],
|
2754 |
queue=False,
|
2755 |
show_progress=False
|
2756 |
|
|
|
704 |
Each bullet point should be in {language} language, with a response length of about {length} words.
|
705 |
''',
|
706 |
'''
|
707 |
+
When generating answers, you should tell people that you are the object itself that was selected in the painting, and generate text in the tone and manner in which you are the object
|
708 |
+
First identify what the object of the first painting is, you save yourself as the parameter: {{object}}, do not need to tell me, the following will use the. I want you to write the recommendation reason according to the following content, as a markdown outline with appropriate emojis that describe what you see according to the painting:
|
709 |
+
Recommendation reason: {{I'm the {{object}} in the painting you were looking at earlier, and I'm recommending this painting based on the fact that I'm also present in the one you're looking at.}} Detailed analysis: Based on the recommendation reason and the relationship between the two paintings, explain why you recommend another painting. Please generate the three points in the tone and manner as if you are the object of this painting and start every sentence with I.
|
710 |
+
Each bullet point should be in { language } language, with a response length of about {length} words.
|
711 |
+
|
712 |
'''],
|
713 |
|
714 |
[
|
|
|
722 |
Each bullet point should be in {language} language, with a response length of about {length} words.
|
723 |
''',
|
724 |
'''
|
725 |
+
When generating answers, you should tell people that I am the painting you were looking at earlier itself, and generate text in the tone and manner in which you are the painting were looking at earlier.
|
726 |
+
First identify what the name of the first painting is, you save yourself as the parameter: {{name}}, do not need to tell me, the following will use the. I want you to write the recommendation reason according to the following content, as a markdown outline with appropriate emojis that describe what you see according to the painting:
|
727 |
+
Recommendation reason: {{I'm the painting {{name}} you were looking at earlier, and I'm recommending this painting based on the fact that I'm similar to the one you're looking at.}} Detailed analysis: Based on the recommendation reason and the relationship between the two paintings, explain why you recommend another painting. Please generate the three points in the tone and manner as if you are the object of this painting and start every sentence with I.
|
|
|
728 |
Each bullet point should be in {language} language, with a response length of about {length} words.
|
729 |
+
|
730 |
'''],
|
731 |
|
732 |
|
|
|
1714 |
return state,state,audio_output,log_state,index,gr.update(value=[])
|
1715 |
|
1716 |
|
1717 |
+
def change_naritive(session_type,image_input, state, click_state, paragraph, origin_image,narritive,task_instruct,gallery_output,style_gallery_result,reco_reasons,language="English"):
|
1718 |
if session_type=="Session 1":
|
1719 |
+
return None, [], [], [[], [], []], "", None, None, [], [],[],[]
|
1720 |
else:
|
1721 |
if language=="English":
|
1722 |
if narritive=="Third-person" :
|
|
|
1764 |
]
|
1765 |
|
1766 |
|
1767 |
+
return image_input, state, state, click_state, paragraph, origin_image,task_instruct,gallery_output,style_gallery_result,reco_reasons,reco_reasons
|
1768 |
|
1769 |
|
1770 |
def print_like_dislike(x: gr.LikeData,state,log_state):
|
|
|
2054 |
with gr.Row():
|
2055 |
|
2056 |
gallery_result = gr.Gallery(
|
2057 |
+
label="Recommendations Based on Object",
|
2058 |
height="auto",
|
2059 |
+
columns=2,
|
2060 |
+
interactive=False
|
2061 |
# columns=4,
|
2062 |
# rows=2,
|
2063 |
# show_label=False,
|
|
|
2072 |
style_gallery_result = gr.Gallery(
|
2073 |
label="Recommendations Based on Style",
|
2074 |
height="auto",
|
2075 |
+
columns=2,
|
2076 |
+
interactive=False
|
2077 |
# columns=4,
|
2078 |
# rows=2,
|
2079 |
# show_label=False,
|
|
|
2751 |
naritive.change(
|
2752 |
change_naritive,
|
2753 |
[session_type, image_input, state, click_state, paragraph, origin_image,naritive,
|
2754 |
+
task_instuction,gallery_result,style_gallery_result,recomended_state,language],
|
2755 |
+
[image_input, chatbot, state, click_state, paragraph, origin_image,task_instuction,gallery_result,style_gallery_result,recomended_state,recommend_bot],
|
2756 |
queue=False,
|
2757 |
show_progress=False
|
2758 |
|