Spaces:
Running
Running
add passwords
Browse files- app.py +20 -11
- passwords.txt +4 -2
app.py
CHANGED
@@ -114,18 +114,18 @@ def detect_features(image_paths, garment_type, language="English"):
|
|
114 |
"content": [
|
115 |
{
|
116 |
"type": "text",
|
117 |
-
"text": """Describe the features of the
|
118 |
-
What is the intended use of the
|
119 |
Generate alt text for each of the images.
|
120 |
-
Make sure to output the alt text in
|
121 |
If the photo does not contain a garment, return 'No garment detected'.
|
122 |
If the photo contains a garment, return the result in in the following JSON format without any preceding or trailing text:
|
123 |
|
124 |
-
{
|
125 |
"features": [list of comma separated features],
|
126 |
"intended_use": [list of comma separated intended uses],
|
127 |
"alt_text": [list of alt text for image 1, alt text for image 2]
|
128 |
-
}"""
|
129 |
},
|
130 |
] + [{
|
131 |
"type": "image_url",
|
@@ -157,11 +157,19 @@ def generate(*data):
|
|
157 |
global visible
|
158 |
print("visible", visible)
|
159 |
|
160 |
-
|
161 |
-
feature, image, garment_type, model, temperature, excluded_words, included_words = data[:
|
162 |
-
struct_ref = data[
|
163 |
-
|
164 |
-
print(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
image_features, base64_images = detect_features(image, garment_type)
|
167 |
detected_features = ""
|
@@ -276,6 +284,7 @@ with gr.Blocks() as demo:
|
|
276 |
temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
|
277 |
excluded_words = gr.Textbox(label="Excluded words", interactive=True, lines=2)
|
278 |
included_words = gr.Textbox(label="Included words", interactive=True, lines=2)
|
|
|
279 |
with gr.Row():
|
280 |
submit = gr.Button(value="Submit")
|
281 |
# advanced = gr.Button(value="Advanced")
|
@@ -295,7 +304,7 @@ with gr.Blocks() as demo:
|
|
295 |
with gr.Column():
|
296 |
md_output = gr.Markdown(label="Output", show_label=True)
|
297 |
json_output = gr.JSON(label="JSON Output")
|
298 |
-
submit.click(generate, inputs=[feature, image, garment_type, model, temperature, excluded_words, included_words, *struct_ref],
|
299 |
outputs=[md_output, json_output])
|
300 |
# advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
|
301 |
|
|
|
114 |
"content": [
|
115 |
{
|
116 |
"type": "text",
|
117 |
+
"text": f"""Describe the features of the {garment_type} in the photos in less than 100 words.
|
118 |
+
What is the intended use of the {garment_type} in this image, use at most 5 words for intended use?
|
119 |
Generate alt text for each of the images.
|
120 |
+
Make sure to output the alt text in {language} language.
|
121 |
If the photo does not contain a garment, return 'No garment detected'.
|
122 |
If the photo contains a garment, return the result in in the following JSON format without any preceding or trailing text:
|
123 |
|
124 |
+
{{
|
125 |
"features": [list of comma separated features],
|
126 |
"intended_use": [list of comma separated intended uses],
|
127 |
"alt_text": [list of alt text for image 1, alt text for image 2]
|
128 |
+
}}"""
|
129 |
},
|
130 |
] + [{
|
131 |
"type": "image_url",
|
|
|
157 |
global visible
|
158 |
print("visible", visible)
|
159 |
|
160 |
+
nargs = 8
|
161 |
+
feature, image, garment_type, model, temperature, excluded_words, included_words, glossary = data[:nargs]
|
162 |
+
struct_ref = data[nargs:]
|
163 |
+
|
164 |
+
print(f"{feature=}")
|
165 |
+
print(f"{image=}")
|
166 |
+
print(f"{garment_type=}")
|
167 |
+
print(f"{model=}")
|
168 |
+
print(f"{temperature=}")
|
169 |
+
print(f"{excluded_words=}")
|
170 |
+
print(f"{included_words=}")
|
171 |
+
print(f"{glossary=}")
|
172 |
+
print(f"{struct_ref=}")
|
173 |
|
174 |
image_features, base64_images = detect_features(image, garment_type)
|
175 |
detected_features = ""
|
|
|
284 |
temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
|
285 |
excluded_words = gr.Textbox(label="Excluded words", interactive=True, lines=2)
|
286 |
included_words = gr.Textbox(label="Included words", interactive=True, lines=2)
|
287 |
+
glossary = gr.Dataframe(row_count = (2, "dynamic"), col_count=(2,"static"), headers=["Description", "Way of writing"], label="Glossary", interactive=True)
|
288 |
with gr.Row():
|
289 |
submit = gr.Button(value="Submit")
|
290 |
# advanced = gr.Button(value="Advanced")
|
|
|
304 |
with gr.Column():
|
305 |
md_output = gr.Markdown(label="Output", show_label=True)
|
306 |
json_output = gr.JSON(label="JSON Output")
|
307 |
+
submit.click(generate, inputs=[feature, image, garment_type, model, temperature, excluded_words, included_words, glossary, *struct_ref],
|
308 |
outputs=[md_output, json_output])
|
309 |
# advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
|
310 |
|
passwords.txt
CHANGED
@@ -1,2 +1,4 @@
|
|
1 |
-
admin $2b$12$
|
2 |
-
user1@dreem.ai $2b$12$Ea1Gzf9psuUN/Urqc1bRJuFKool9Duy1rHpTfayfXdbWKxO67W0qe
|
|
|
|
|
|
1 |
+
admin $2b$12$3GY/E7b.Zm1B77iVhDbEZOA/3nJw0qxcI0korp4/3DBGU82816gBe
|
2 |
+
user1@dreem.ai $2b$12$Ea1Gzf9psuUN/Urqc1bRJuFKool9Duy1rHpTfayfXdbWKxO67W0qe
|
3 |
+
vuong@creativeforce.io $2b$12$Ea1Gzf9psuUN/Urqc1bRJuFKool9Duy1rHpTfayfXdbWKxO67W0qe
|
4 |
+
user2@dreem.ai $2b$12$ujCWCn1Oo0bDthaktJqJyuUl/QeXWXKN5FsRrBCl0r2oZUeiS07u2
|