laurenssam commited on
Commit
b7a2ebc
·
1 Parent(s): d8b96ee

fix interface

Browse files
Files changed (1) hide show
  1. app.py +58 -58
app.py CHANGED
@@ -276,7 +276,7 @@ def http_bot(state, temperature, top_p, max_new_tokens):
276
  pload = {
277
  "model": model_name,
278
  "prompt": prompt,
279
- "temperature": float(temperature),
280
  "top_p": float(top_p),
281
  "max_new_tokens": min(int(max_new_tokens), 1536),
282
  "stop": (
@@ -318,63 +318,63 @@ def build_demo():
318
 
319
  with gr.Row():
320
  with gr.Column(scale=5):
321
- with gr.Row(elem_id="Model ID"):
322
- gr.Dropdown(
323
- choices=[DEFAULT_MODEL_NAME],
324
- value=DEFAULT_MODEL_NAME,
325
- interactive=True,
326
- label="Model ID",
327
- container=False,
328
- )
329
- imagebox = gr.Image(type="pil")
330
- image_process_mode = gr.Radio(
331
- ["Crop", "Resize", "Pad", "Default"],
332
- value="Default",
333
- label="Preprocess for non-square image",
334
- visible=False,
335
- )
336
-
337
- # cur_dir = os.path.dirname(os.path.abspath(__file__))
338
- cur_dir = Path(__file__).parent
339
- gr.Examples(
340
- examples=[
341
- [
342
- f"{cur_dir}/examples/extreme_ironing.jpg",
343
- "What is unusual about this image?",
344
- ],
345
- [
346
- f"{cur_dir}/examples/waterview.jpg",
347
- "What are the things I should be cautious about when I visit here?",
348
- ],
349
- ],
350
- inputs=[imagebox, textbox],
351
- )
352
-
353
- with gr.Accordion("Parameters", open=False) as _:
354
- temperature = gr.Slider(
355
- minimum=0.0,
356
- maximum=1.0,
357
- value=0.2,
358
- step=0.1,
359
- interactive=True,
360
- label="Temperature",
361
- )
362
- top_p = gr.Slider(
363
- minimum=0.0,
364
- maximum=1.0,
365
- value=0.7,
366
- step=0.1,
367
- interactive=True,
368
- label="Top P",
369
- )
370
- max_output_tokens = gr.Slider(
371
- minimum=0,
372
- maximum=1024,
373
- value=512,
374
- step=64,
375
- interactive=True,
376
- label="Max output tokens",
377
- )
378
 
379
  with gr.Column(scale=8):
380
  chatbot = gr.Chatbot(elem_id="chatbot", label="Chatbot", height=550)
 
276
  pload = {
277
  "model": model_name,
278
  "prompt": prompt,
279
+ "temperature": float(0.),
280
  "top_p": float(top_p),
281
  "max_new_tokens": min(int(max_new_tokens), 1536),
282
  "stop": (
 
318
 
319
  with gr.Row():
320
  with gr.Column(scale=5):
321
+ # with gr.Row(elem_id="Model ID"):
322
+ # gr.Dropdown(
323
+ # choices=[DEFAULT_MODEL_NAME],
324
+ # value=DEFAULT_MODEL_NAME,
325
+ # interactive=True,
326
+ # label="Model ID",
327
+ # container=False,
328
+ # )
329
+ # imagebox = gr.Image(type="pil")
330
+ # image_process_mode = gr.Radio(
331
+ # ["Crop", "Resize", "Pad", "Default"],
332
+ # value="Default",
333
+ # label="Preprocess for non-square image",
334
+ # visible=False,
335
+ # )
336
+
337
+ # # cur_dir = os.path.dirname(os.path.abspath(__file__))
338
+ # cur_dir = Path(__file__).parent
339
+ # gr.Examples(
340
+ # examples=[
341
+ # [
342
+ # f"{cur_dir}/examples/extreme_ironing.jpg",
343
+ # "What is unusual about this image?",
344
+ # ],
345
+ # [
346
+ # f"{cur_dir}/examples/waterview.jpg",
347
+ # "What are the things I should be cautious about when I visit here?",
348
+ # ],
349
+ # ],
350
+ # inputs=[imagebox, textbox],
351
+ # )
352
+
353
+ # with gr.Accordion("Parameters", open=False) as _:
354
+ # temperature = gr.Slider(
355
+ # minimum=0.0,
356
+ # maximum=1.0,
357
+ # value=0.2,
358
+ # step=0.1,
359
+ # interactive=True,
360
+ # label="Temperature",
361
+ # )
362
+ # top_p = gr.Slider(
363
+ # minimum=0.0,
364
+ # maximum=1.0,
365
+ # value=0.7,
366
+ # step=0.1,
367
+ # interactive=True,
368
+ # label="Top P",
369
+ # )
370
+ # max_output_tokens = gr.Slider(
371
+ # minimum=0,
372
+ # maximum=1024,
373
+ # value=512,
374
+ # step=64,
375
+ # interactive=True,
376
+ # label="Max output tokens",
377
+ # )
378
 
379
  with gr.Column(scale=8):
380
  chatbot = gr.Chatbot(elem_id="chatbot", label="Chatbot", height=550)