tunght commited on
Commit
1e3bf35
·
1 Parent(s): d0733e2

add exlucded, included words

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -157,8 +157,8 @@ def generate(*data):
157
  global visible
158
  print("visible", visible)
159
 
160
- feature, image, garment_type, model, temperature = data[:5]
161
- struct_ref = data[5:]
162
 
163
  print(f"features {feature},\n image {image},\n garment_type {garment_type},\n model {model},\n temperature {temperature},\n struct_ref {struct_ref}")
164
 
@@ -193,7 +193,15 @@ def generate(*data):
193
  If the reference text is not empty, write the product description in the tone of voice of the reference text.
194
  Make sure to output the product description only, do not include any preceeding text like "Here is your product description".
195
  Do not include any part of the reference structure in the output.
196
- \n\n {feature + detected_features} \n{intended_use} \nReference structure: {structure}\n Reference text: {reference}""")]
 
 
 
 
 
 
 
 
197
  batch.append(messages)
198
 
199
  description = ""
@@ -260,6 +268,8 @@ with gr.Blocks() as demo:
260
  with gr.Accordion(label="Advanced Options", open=False):
261
  model = gr.Dropdown(models, value="gpt-4-turbo", interactive=True, label="Model", visible=True)
262
  temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
 
 
263
  with gr.Row():
264
  submit = gr.Button(value="Submit")
265
  # advanced = gr.Button(value="Advanced")
@@ -278,7 +288,7 @@ with gr.Blocks() as demo:
278
  with gr.Column():
279
  md_output = gr.Markdown(label="Output", show_label=True)
280
  json_output = gr.JSON(label="JSON Output")
281
- submit.click(generate, inputs=[feature, image, garment_type, model, temperature, *struct_ref],
282
  outputs=[md_output, json_output])
283
  # advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
284
 
@@ -300,4 +310,5 @@ def authf(username, password):
300
 
301
 
302
  if __name__ == '__main__':
303
- demo.launch(server_name="0.0.0.0", auth=authf)
 
 
157
  global visible
158
  print("visible", visible)
159
 
160
+ feature, image, garment_type, model, temperature, excluded_words, included_words = data[:7]
161
+ struct_ref = data[7:]
162
 
163
  print(f"features {feature},\n image {image},\n garment_type {garment_type},\n model {model},\n temperature {temperature},\n struct_ref {struct_ref}")
164
 
 
193
  If the reference text is not empty, write the product description in the tone of voice of the reference text.
194
  Make sure to output the product description only, do not include any preceeding text like "Here is your product description".
195
  Do not include any part of the reference structure in the output.
196
+ Do not use any of the excluded words in the output.
197
+ Make sure to include all of the included words in the output.
198
+
199
+ {feature + detected_features}
200
+ {intended_use}
201
+ Reference structure: {structure}
202
+ Reference text: {reference}
203
+ Included words: {included_words}
204
+ Excluded words: {excluded_words}"""),]
205
  batch.append(messages)
206
 
207
  description = ""
 
268
  with gr.Accordion(label="Advanced Options", open=False):
269
  model = gr.Dropdown(models, value="gpt-4-turbo", interactive=True, label="Model", visible=True)
270
  temperature = gr.Slider(minimum=0., maximum=1.0, value=0., interactive=True, label="Temperature", visible=True)
271
+ excluded_words = gr.Textbox(label="Excluded words", interactive=True, lines=2)
272
+ included_words = gr.Textbox(label="Included words", interactive=True, lines=2)
273
  with gr.Row():
274
  submit = gr.Button(value="Submit")
275
  # advanced = gr.Button(value="Advanced")
 
288
  with gr.Column():
289
  md_output = gr.Markdown(label="Output", show_label=True)
290
  json_output = gr.JSON(label="JSON Output")
291
+ submit.click(generate, inputs=[feature, image, garment_type, model, temperature, excluded_words, included_words, *struct_ref],
292
  outputs=[md_output, json_output])
293
  # advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
294
 
 
310
 
311
 
312
  if __name__ == '__main__':
313
+ # demo.launch(server_name="0.0.0.0", auth=authf)
314
+ demo.launch()