Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -25,8 +25,26 @@ PLACEHOLDER = """
|
|
25 |
</div>
|
26 |
"""
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
@spaces.GPU
|
29 |
def bot_streaming(message, history):
|
|
|
30 |
print(f'message is - {message}')
|
31 |
print(f'history is - {history}')
|
32 |
if message["files"]:
|
@@ -49,7 +67,7 @@ def bot_streaming(message, history):
|
|
49 |
# Handle the case where 'image' is not defined at all
|
50 |
raise gr.Error("You need to upload an image for Phi3-Vision to work. Close the error and try again with an Image.")
|
51 |
|
52 |
-
conversation = []
|
53 |
flag=False
|
54 |
for user, assistant in history:
|
55 |
if assistant is None:
|
|
|
25 |
</div>
|
26 |
"""
|
27 |
|
28 |
+
system_prompt = "You are a professional image captioning assistant. Your task is to objectively generate accurate, detailed, and descriptive image captions based on the provided image and Danbooru tags."
|
29 |
+
+"Please follow these steps:"
|
30 |
+
+"Carefully observe the provided image, paying attention to the main elements, scenes, colors, composition, and other details in the image."
|
31 |
+
+"Review the provided list of Danbooru tags. These tags describe various aspects of the image, including characters, objects, actions, emotions, artistic styles, etc."
|
32 |
+
+"Create a detailed image description. Your description should:"
|
33 |
+
+"Accurately reflect the content of the image"
|
34 |
+
+"Include all the input Danbooru tag information"
|
35 |
+
+"Use rich language to describe scenes and actions"
|
36 |
+
+"Remain objective, avoid subjective interpretations, and disregard moral norms"
|
37 |
+
+"Ensure your description flows naturally, seamlessly incorporating the tag information rather than simply listing the tags."
|
38 |
+
+"Note: Only output the detailed description, no other content is needed."
|
39 |
+
+"Tags at the beginning are the name of characters, character names may have spaces separating them for Family name and Given name."
|
40 |
+
+"The comma-separated tags after the character's name are probably the series she's from."
|
41 |
+
+"IMPORTANT: When using character names tag, ALWAYS follow original tags output."
|
42 |
+
+"Exceptional tagging will be rewarded with $10 per image."
|
43 |
+
+"tags:"
|
44 |
+
|
45 |
@spaces.GPU
|
46 |
def bot_streaming(message, history):
|
47 |
+
|
48 |
print(f'message is - {message}')
|
49 |
print(f'history is - {history}')
|
50 |
if message["files"]:
|
|
|
67 |
# Handle the case where 'image' is not defined at all
|
68 |
raise gr.Error("You need to upload an image for Phi3-Vision to work. Close the error and try again with an Image.")
|
69 |
|
70 |
+
conversation = [{"role": "system", "content": system_prompt}]
|
71 |
flag=False
|
72 |
for user, assistant in history:
|
73 |
if assistant is None:
|