Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,8 @@ import json
|
|
| 4 |
|
| 5 |
from gradio_client import Client, handle_file
|
| 6 |
backend = Client(os.getenv("BACKEND"), hf_token=os.getenv("TOKEN"))
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def detect(image):
|
| 9 |
result_text = backend.predict(
|
|
@@ -73,6 +75,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 73 |
lbl_aigen.render()
|
| 74 |
with gr.Column():
|
| 75 |
lbl_deepfake.render()
|
|
|
|
| 76 |
gr.HTML(MARKDOWN3)
|
| 77 |
with gr.Row():
|
| 78 |
with gr.Column(scale=1):
|
|
@@ -80,6 +83,8 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 80 |
with gr.Column(scale=5):
|
| 81 |
html = gr.HTML()
|
| 82 |
|
|
|
|
|
|
|
| 83 |
detect_button.click(detect, inputs=[image], outputs=[lbl_overall, lbl_aigen, lbl_deepfake], api_name=False)
|
| 84 |
|
| 85 |
demo.queue(api_open=False, default_concurrency_limit=8).launch(server_name="0.0.0.0", show_api=False)
|
|
|
|
| 4 |
|
| 5 |
from gradio_client import Client, handle_file
|
| 6 |
backend = Client(os.getenv("BACKEND"), hf_token=os.getenv("TOKEN"))
|
| 7 |
+
JS_FUNC1 = os.getenv("JS_FUNC1")
|
| 8 |
+
JS_FUNC2 = os.getenv("JS_FUNC2")
|
| 9 |
|
| 10 |
def detect(image):
|
| 11 |
result_text = backend.predict(
|
|
|
|
| 75 |
lbl_aigen.render()
|
| 76 |
with gr.Column():
|
| 77 |
lbl_deepfake.render()
|
| 78 |
+
gr.HTML("<div id='limit'></div>")
|
| 79 |
gr.HTML(MARKDOWN3)
|
| 80 |
with gr.Row():
|
| 81 |
with gr.Column(scale=1):
|
|
|
|
| 83 |
with gr.Column(scale=5):
|
| 84 |
html = gr.HTML()
|
| 85 |
|
| 86 |
+
demo.load(None, inputs=None, outputs=html, js=JS_FUNC1)
|
| 87 |
+
limit_button.click(None, js=JS_FUNC2)
|
| 88 |
detect_button.click(detect, inputs=[image], outputs=[lbl_overall, lbl_aigen, lbl_deepfake], api_name=False)
|
| 89 |
|
| 90 |
demo.queue(api_open=False, default_concurrency_limit=8).launch(server_name="0.0.0.0", show_api=False)
|