Spaces:
Sleeping
Sleeping
HaochenGong commited on
Commit 路
5600213
1
Parent(s): ac599dd
test
Browse files
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 |
-
|
| 347 |
|
| 348 |
with gr.Blocks() as demo:
|
| 349 |
-
html_output = gr.HTML(
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
|
|
|
| 404 |
|
| 405 |
# image_input = gr.Image(type="pil", label="Screenshot Upload", elem_id="image_input")
|
| 406 |
|
| 407 |
-
gr.HTML("""
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 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(
|
| 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)
|