LouisLi commited on
Commit
8ed8e45
·
verified ·
1 Parent(s): cce94d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -1245,10 +1245,10 @@ def create_ui():
1245
  with gr.Row(visible=False, elem_id="top_row") as top_row:
1246
  language = gr.Dropdown(
1247
  ['English', 'Chinese', 'French', "Spanish", "Arabic", "Portuguese", "Cantonese"],
1248
- value="English", label="Language", interactive=True, scale=0.2, elem_classes="custom-language"
1249
  )
1250
  auto_play = gr.Checkbox(
1251
- label="Check to autoplay audio", value=False, scale=0.4, elem_classes="custom-autoplay"
1252
  )
1253
  output_audio = gr.HTML(
1254
  label="Synthesised Audio", elem_classes="custom-output"
@@ -1266,7 +1266,7 @@ def create_ui():
1266
 
1267
  with gr.Row():
1268
 
1269
- with gr.Column(scale=1.0):
1270
  with gr.Column(visible=False) as modules_not_need_gpt:
1271
  with gr.Tab("Base(GPT Power)",visible=False) as base_tab:
1272
  image_input_base = gr.Image(type="pil", interactive=True, elem_id="image_upload")
@@ -1285,17 +1285,17 @@ def create_ui():
1285
  artist_label = gr.Button(value="Artist: ")
1286
  year_label = gr.Button(value="Year: ")
1287
  material_label = gr.Button(value="Material: ")
1288
- with gr.Row(scale=1.0):
1289
- with gr.Row(scale=0.8):
1290
  focus_type = gr.Radio(
1291
  choices=["CFV-D", "CFV-DA", "CFV-DAI","PFV-DDA"],
1292
  value="CFV-D",
1293
  label="Information Type",
1294
  interactive=True)
1295
- with gr.Row(scale=0.2):
1296
  submit_button_click=gr.Button(value="Submit", interactive=True,variant='primary',size="sm")
1297
- with gr.Row(scale=1.0):
1298
- with gr.Row(scale=0.4):
1299
  point_prompt = gr.Radio(
1300
  choices=["Positive", "Negative"],
1301
  value="Positive",
@@ -1306,7 +1306,7 @@ def create_ui():
1306
  value="Continuous",
1307
  label="Clicking Mode",
1308
  interactive=True)
1309
- with gr.Row(scale=0.4):
1310
  clear_button_click = gr.Button(value="Clear Clicks", interactive=True)
1311
  clear_button_image = gr.Button(value="Clear Image", interactive=True)
1312
 
@@ -1317,8 +1317,8 @@ def create_ui():
1317
  with gr.Row():
1318
  submit_button_sketcher = gr.Button(value="Submit", interactive=True)
1319
  clear_button_sketcher = gr.Button(value="Clear Sketch", interactive=True)
1320
- with gr.Row(scale=1.0):
1321
- with gr.Row(scale=0.8):
1322
  focus_type_sketch = gr.Radio(
1323
  choices=["CFV-D", "CFV-DA", "CFV-DAI","PFV-DDA"],
1324
  value="CFV-D",
@@ -1331,14 +1331,14 @@ def create_ui():
1331
  interactive=True)
1332
 
1333
  with gr.Column(visible=False) as modules_need_gpt1:
1334
- with gr.Row(scale=1.0):
1335
  sentiment = gr.Radio(
1336
  choices=["Positive", "Natural", "Negative"],
1337
  value="Natural",
1338
  label="Sentiment",
1339
  interactive=True,
1340
  )
1341
- with gr.Row(scale=1.0):
1342
  factuality = gr.Radio(
1343
  choices=["Factual", "Imagination"],
1344
  value="Factual",
@@ -1369,7 +1369,7 @@ def create_ui():
1369
 
1370
 
1371
 
1372
- with gr.Column(scale=0.5):
1373
  with gr.Column(visible=True) as module_key_input:
1374
  openai_api_key = gr.Textbox(
1375
  placeholder="Input openAI API key",
@@ -1377,7 +1377,7 @@ def create_ui():
1377
  label="OpenAI API Key",
1378
  lines=1,
1379
  type="password")
1380
- with gr.Row(scale=0.5):
1381
  enable_chatGPT_button = gr.Button(value="Run with ChatGPT", interactive=True, variant='primary')
1382
  disable_chatGPT_button = gr.Button(value="Run without ChatGPT (Faster)", interactive=True,
1383
  variant='primary')
@@ -1385,13 +1385,13 @@ def create_ui():
1385
  notification_box = gr.Textbox(lines=1, label="Notification", max_lines=5, show_label=False)
1386
 
1387
  with gr.Column() as modules_need_gpt0:
1388
- with gr.Column(visible=False,scale=1.0) as modules_need_gpt2:
1389
  paragraph_output = gr.Textbox(lines=16, label="Describe Everything", max_lines=16)
1390
  cap_everything_button = gr.Button(value="Caption Everything in a Paragraph", interactive=True)
1391
 
1392
  with gr.Column(visible=False) as modules_not_need_gpt2:
1393
  with gr.Blocks():
1394
- chatbot = gr.Chatbot(label="Chatbox", elem_classes="chatbot",likeable=True).style(height=600, scale=0.5)
1395
  with gr.Column(visible=False) as modules_need_gpt3:
1396
  chat_input = gr.Textbox(show_label=False, placeholder="Enter text and press Enter").style(
1397
  container=False)
@@ -1427,7 +1427,7 @@ def create_ui():
1427
 
1428
  with gr.Row(variant="panel") as text2image_model:
1429
 
1430
- with gr.Column(scale=0.4):
1431
  with gr.Column():
1432
  gr.Radio([artist], label="Artist", info="Who is the artist?🧑‍🎨"),
1433
  gr.Radio(["Oil Painting","Printmaking","Watercolor Painting","Drawing"], label="Art Forms", info="What are the art forms?🎨"),
@@ -1445,7 +1445,7 @@ def create_ui():
1445
  placeholder="Enter your prompt",
1446
  container=False,
1447
  )
1448
- run_button = gr.Button("Run", scale=0)
1449
 
1450
  with gr.Accordion("Advanced options", open=False):
1451
  num_images = gr.Slider(
@@ -1503,7 +1503,7 @@ def create_ui():
1503
  step=1,
1504
  value=8,
1505
  )
1506
- with gr.Column(scale=0.6):
1507
  result = gr.Gallery(
1508
  label="Result"
1509
  # columns=4,
 
1245
  with gr.Row(visible=False, elem_id="top_row") as top_row:
1246
  language = gr.Dropdown(
1247
  ['English', 'Chinese', 'French', "Spanish", "Arabic", "Portuguese", "Cantonese"],
1248
+ value="English", label="Language", interactive=True, elem_classes="custom-language"
1249
  )
1250
  auto_play = gr.Checkbox(
1251
+ label="Check to autoplay audio", value=False, elem_classes="custom-autoplay"
1252
  )
1253
  output_audio = gr.HTML(
1254
  label="Synthesised Audio", elem_classes="custom-output"
 
1266
 
1267
  with gr.Row():
1268
 
1269
+ with gr.Column():
1270
  with gr.Column(visible=False) as modules_not_need_gpt:
1271
  with gr.Tab("Base(GPT Power)",visible=False) as base_tab:
1272
  image_input_base = gr.Image(type="pil", interactive=True, elem_id="image_upload")
 
1285
  artist_label = gr.Button(value="Artist: ")
1286
  year_label = gr.Button(value="Year: ")
1287
  material_label = gr.Button(value="Material: ")
1288
+ with gr.Row():
1289
+ with gr.Row():
1290
  focus_type = gr.Radio(
1291
  choices=["CFV-D", "CFV-DA", "CFV-DAI","PFV-DDA"],
1292
  value="CFV-D",
1293
  label="Information Type",
1294
  interactive=True)
1295
+ with gr.Row():
1296
  submit_button_click=gr.Button(value="Submit", interactive=True,variant='primary',size="sm")
1297
+ with gr.Row():
1298
+ with gr.Row():
1299
  point_prompt = gr.Radio(
1300
  choices=["Positive", "Negative"],
1301
  value="Positive",
 
1306
  value="Continuous",
1307
  label="Clicking Mode",
1308
  interactive=True)
1309
+ with gr.Row():
1310
  clear_button_click = gr.Button(value="Clear Clicks", interactive=True)
1311
  clear_button_image = gr.Button(value="Clear Image", interactive=True)
1312
 
 
1317
  with gr.Row():
1318
  submit_button_sketcher = gr.Button(value="Submit", interactive=True)
1319
  clear_button_sketcher = gr.Button(value="Clear Sketch", interactive=True)
1320
+ with gr.Row():
1321
+ with gr.Row():
1322
  focus_type_sketch = gr.Radio(
1323
  choices=["CFV-D", "CFV-DA", "CFV-DAI","PFV-DDA"],
1324
  value="CFV-D",
 
1331
  interactive=True)
1332
 
1333
  with gr.Column(visible=False) as modules_need_gpt1:
1334
+ with gr.Row():
1335
  sentiment = gr.Radio(
1336
  choices=["Positive", "Natural", "Negative"],
1337
  value="Natural",
1338
  label="Sentiment",
1339
  interactive=True,
1340
  )
1341
+ with gr.Row():
1342
  factuality = gr.Radio(
1343
  choices=["Factual", "Imagination"],
1344
  value="Factual",
 
1369
 
1370
 
1371
 
1372
+ with gr.Column():
1373
  with gr.Column(visible=True) as module_key_input:
1374
  openai_api_key = gr.Textbox(
1375
  placeholder="Input openAI API key",
 
1377
  label="OpenAI API Key",
1378
  lines=1,
1379
  type="password")
1380
+ with gr.Row():
1381
  enable_chatGPT_button = gr.Button(value="Run with ChatGPT", interactive=True, variant='primary')
1382
  disable_chatGPT_button = gr.Button(value="Run without ChatGPT (Faster)", interactive=True,
1383
  variant='primary')
 
1385
  notification_box = gr.Textbox(lines=1, label="Notification", max_lines=5, show_label=False)
1386
 
1387
  with gr.Column() as modules_need_gpt0:
1388
+ with gr.Column(visible=False) as modules_need_gpt2:
1389
  paragraph_output = gr.Textbox(lines=16, label="Describe Everything", max_lines=16)
1390
  cap_everything_button = gr.Button(value="Caption Everything in a Paragraph", interactive=True)
1391
 
1392
  with gr.Column(visible=False) as modules_not_need_gpt2:
1393
  with gr.Blocks():
1394
+ chatbot = gr.Chatbot(label="Chatbox", elem_classes="chatbot",likeable=True).style(height=600)
1395
  with gr.Column(visible=False) as modules_need_gpt3:
1396
  chat_input = gr.Textbox(show_label=False, placeholder="Enter text and press Enter").style(
1397
  container=False)
 
1427
 
1428
  with gr.Row(variant="panel") as text2image_model:
1429
 
1430
+ with gr.Column():
1431
  with gr.Column():
1432
  gr.Radio([artist], label="Artist", info="Who is the artist?🧑‍🎨"),
1433
  gr.Radio(["Oil Painting","Printmaking","Watercolor Painting","Drawing"], label="Art Forms", info="What are the art forms?🎨"),
 
1445
  placeholder="Enter your prompt",
1446
  container=False,
1447
  )
1448
+ run_button = gr.Button("Run")
1449
 
1450
  with gr.Accordion("Advanced options", open=False):
1451
  num_images = gr.Slider(
 
1503
  step=1,
1504
  value=8,
1505
  )
1506
+ with gr.Column():
1507
  result = gr.Gallery(
1508
  label="Result"
1509
  # columns=4,