HaochenGong commited on
Commit
5600213
1 Parent(s): ac599dd
Files changed (1) hide show
  1. app.py +76 -73
app.py CHANGED
@@ -341,84 +341,87 @@ def generate_html_with_image_and_text(img_output, text):
341
  # def toggle_dataframe_callback():
342
  # complete_result_dataframe.visible = not complete_result_dataframe.visible
343
 
 
 
344
 
345
- with open('web_page.css', 'r') as css_file:
346
- css = css_file.read()
347
 
348
  with gr.Blocks() as demo:
349
- html_output = gr.HTML("""
350
- <div class="title">
351
- <div class="title_half title_content">
352
- <h1>Cpp4App</h1>
353
- <p>Automated Contextual Privacy Policies Generation for Mobile Apps.</p>
354
- <div class="choice">
355
- <a href="#workspace" class="start choice_btn">START</a>
356
- <a href="#examples" class="view_examples choice_btn">View examples</a>
357
- </div>
358
- </div>
359
- <div class="title_half">
360
- <img src="https://buyanghc.github.io/head.jpg" alt="">
361
- </div>
362
- </div>
363
-
364
- <div class="examples" id="examples">
365
- <div class="head">
366
- <h2>EXAMPLES</h2>
367
- </div>
368
- <p>Click to run the example !</p>
369
- <div class="img_box">
370
- <div class="eg">
371
- <a href="#step2" id="eg1"><img src="https://buyanghc.github.io/eg1.jpg" alt=""></a>
372
- <p> WhatsApp</p>
373
- </div>
374
- <div class="eg">
375
- <a href="#step2" id="eg2"><img src="https://buyanghc.github.io/eg2.jpg" alt=""></a>
376
- <p> Snap</p>
377
- </div>
378
- <div class="eg">
379
- <a href="#step2" id="eg3"><img src="https://buyanghc.github.io/eg3.jpg" alt=""></a>
380
- <p> Mcdonald's</p>
381
- </div>
382
- </div>
383
- </div>
384
-
385
- <div class="workspace" id="workspace">
386
- <div class="head">
387
- <h2>WORKSPACE</h2>
388
- <div class="workspace_btn">
389
- <input class="btn run" type="submit" value="RUN">
390
- <button class="btn reset">RESET</button>
391
- </div>
392
- </div>
393
-
394
- <div class="space">
395
- <div class="step1">
396
- <label for="inputBox">Step 1 : Input privacy policy URL</label>
397
- <input class="url" type="text" id="inputBox" name="inputBox" placeholder="Privacy Policy URL Link" />
398
- </div>
399
-
400
- <div class="step2" id="step2">
401
- <div class="img">
402
- <label for="image-input">Step 2 : Upload the screenshot</label>
403
- """)
 
404
 
405
  # image_input = gr.Image(type="pil", label="Screenshot Upload", elem_id="image_input")
406
 
407
- gr.HTML("""
408
- </div>
409
- <div class="point"><img src="https://buyanghc.github.io/point.png" alt=""></div>
410
- <div class="img">
411
- <label>Outcome :</label>
412
- <div class="phone" id="output">
413
- <img src="" alt="" id="result">
414
- <div class="left next_btn"></div>
415
- <div class="right next_btn"></div>
416
- </div>
417
- </div>
418
- </div>
419
- </div>
420
- </div>
421
- """)
422
 
423
  # 闅愯棌鐨刧radio缁勪欢
424
  eg_btn1 = gr.Button("Example 1", elem_id="example1", visible=True)
@@ -525,7 +528,7 @@ threading.Thread(target=schedule_restarts, args=(24,)).start() # restart per 24
525
  threading.Thread(target=schedule_monitoring, args=(12,)).start() # monitor resources using per 12 hours
526
 
527
  try:
528
- demo.launch(css=css)
529
  logger.info('Gradio app launched successfully')
530
  except Exception as e:
531
  logger.error('Error occurred while launching Gradio app', exc_info=True)
 
341
  # def toggle_dataframe_callback():
342
  # complete_result_dataframe.visible = not complete_result_dataframe.visible
343
 
344
+ with open('web_page.html', 'r') as file:
345
+ html_content = file.read()
346
 
347
+ # with open('web_page.css', 'r') as css_file:
348
+ # css = css_file.read()
349
 
350
  with gr.Blocks() as demo:
351
+ html_output = gr.HTML(html_content)
352
+ # html_output = gr.HTML("""
353
+ # <div class="title">
354
+ # <div class="title_half title_content">
355
+ # <h1>Cpp4App</h1>
356
+ # <p>Automated Contextual Privacy Policies Generation for Mobile Apps.</p>
357
+ # <div class="choice">
358
+ # <a href="#workspace" class="start choice_btn">START</a>
359
+ # <a href="#examples" class="view_examples choice_btn">View examples</a>
360
+ # </div>
361
+ # </div>
362
+ # <div class="title_half">
363
+ # <img src="https://buyanghc.github.io/head.jpg" alt="">
364
+ # </div>
365
+ # </div>
366
+ #
367
+ # <div class="examples" id="examples">
368
+ # <div class="head">
369
+ # <h2>EXAMPLES</h2>
370
+ # </div>
371
+ # <p>Click to run the example !</p>
372
+ # <div class="img_box">
373
+ # <div class="eg">
374
+ # <a href="#step2" id="eg1"><img src="https://buyanghc.github.io/eg1.jpg" alt=""></a>
375
+ # <p>路 WhatsApp</p>
376
+ # </div>
377
+ # <div class="eg">
378
+ # <a href="#step2" id="eg2"><img src="https://buyanghc.github.io/eg2.jpg" alt=""></a>
379
+ # <p>路 Snap</p>
380
+ # </div>
381
+ # <div class="eg">
382
+ # <a href="#step2" id="eg3"><img src="https://buyanghc.github.io/eg3.jpg" alt=""></a>
383
+ # <p>路 Mcdonald's</p>
384
+ # </div>
385
+ # </div>
386
+ # </div>
387
+ #
388
+ # <div class="workspace" id="workspace">
389
+ # <div class="head">
390
+ # <h2>WORKSPACE</h2>
391
+ # <div class="workspace_btn">
392
+ # <input class="btn run" type="submit" value="RUN">
393
+ # <button class="btn reset">RESET</button>
394
+ # </div>
395
+ # </div>
396
+ #
397
+ # <div class="space">
398
+ # <div class="step1">
399
+ # <label for="inputBox">Step 1 : Input privacy policy URL</label>
400
+ # <input class="url" type="text" id="inputBox" name="inputBox" placeholder="Privacy Policy URL Link" />
401
+ # </div>
402
+ #
403
+ # <div class="step2" id="step2">
404
+ # <div class="img">
405
+ # <label for="image-input">Step 2 : Upload the screenshot</label>
406
+ # """)
407
 
408
  # image_input = gr.Image(type="pil", label="Screenshot Upload", elem_id="image_input")
409
 
410
+ # gr.HTML("""
411
+ # </div>
412
+ # <div class="point"><img src="https://buyanghc.github.io/point.png" alt=""></div>
413
+ # <div class="img">
414
+ # <label>Outcome :</label>
415
+ # <div class="phone" id="output">
416
+ # <img src="" alt="" id="result">
417
+ # <div class="left next_btn"></div>
418
+ # <div class="right next_btn"></div>
419
+ # </div>
420
+ # </div>
421
+ # </div>
422
+ # </div>
423
+ # </div>
424
+ # """)
425
 
426
  # 闅愯棌鐨刧radio缁勪欢
427
  eg_btn1 = gr.Button("Example 1", elem_id="example1", visible=True)
 
528
  threading.Thread(target=schedule_monitoring, args=(12,)).start() # monitor resources using per 12 hours
529
 
530
  try:
531
+ demo.launch()
532
  logger.info('Gradio app launched successfully')
533
  except Exception as e:
534
  logger.error('Error occurred while launching Gradio app', exc_info=True)