Spaces:
Running
Running
Commit
·
b8e1457
1
Parent(s):
11a16aa
Add header and footer with asking for a star
Browse files- app.py +6 -0
- wordings.py +26 -5
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import atexit
|
|
|
|
| 2 |
|
| 3 |
import gradio as gr
|
| 4 |
|
|
@@ -6,15 +7,18 @@ from app_debug import get_demo as get_demo_debug
|
|
| 6 |
from app_leaderboard import get_demo as get_demo_leaderboard
|
| 7 |
from app_text_classification import get_demo as get_demo_text_classification
|
| 8 |
from run_jobs import start_process_run_job, stop_thread
|
|
|
|
| 9 |
|
| 10 |
try:
|
| 11 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="green")) as demo:
|
|
|
|
| 12 |
with gr.Tab("Text Classification"):
|
| 13 |
get_demo_text_classification()
|
| 14 |
with gr.Tab("Leaderboard") as leaderboard_tab:
|
| 15 |
get_demo_leaderboard(leaderboard_tab)
|
| 16 |
with gr.Tab("Logs(Debug)"):
|
| 17 |
get_demo_debug()
|
|
|
|
| 18 |
|
| 19 |
start_process_run_job()
|
| 20 |
|
|
@@ -23,5 +27,7 @@ try:
|
|
| 23 |
atexit.register(stop_thread)
|
| 24 |
|
| 25 |
except Exception as e:
|
|
|
|
|
|
|
| 26 |
print("stop background thread: ", e)
|
| 27 |
stop_thread()
|
|
|
|
| 1 |
import atexit
|
| 2 |
+
import traceback
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
|
|
|
|
| 7 |
from app_leaderboard import get_demo as get_demo_leaderboard
|
| 8 |
from app_text_classification import get_demo as get_demo_text_classification
|
| 9 |
from run_jobs import start_process_run_job, stop_thread
|
| 10 |
+
from wordings import TITLE_MD, FOOTER_HTML
|
| 11 |
|
| 12 |
try:
|
| 13 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="green")) as demo:
|
| 14 |
+
gr.Markdown(TITLE_MD)
|
| 15 |
with gr.Tab("Text Classification"):
|
| 16 |
get_demo_text_classification()
|
| 17 |
with gr.Tab("Leaderboard") as leaderboard_tab:
|
| 18 |
get_demo_leaderboard(leaderboard_tab)
|
| 19 |
with gr.Tab("Logs(Debug)"):
|
| 20 |
get_demo_debug()
|
| 21 |
+
gr.HTML(FOOTER_HTML)
|
| 22 |
|
| 23 |
start_process_run_job()
|
| 24 |
|
|
|
|
| 27 |
atexit.register(stop_thread)
|
| 28 |
|
| 29 |
except Exception as e:
|
| 30 |
+
# Print stack trace back
|
| 31 |
+
print(traceback.format_exc())
|
| 32 |
print("stop background thread: ", e)
|
| 33 |
stop_thread()
|
wordings.py
CHANGED
|
@@ -1,13 +1,34 @@
|
|
| 1 |
EXAMPLE_MODEL_ID = "cardiffnlp/twitter-roberta-base-sentiment-latest"
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
INTRODUCTION_MD = """
|
| 4 |
<div style="display: flex; justify-content: center;">
|
| 5 |
-
<
|
| 6 |
-
|
| 7 |
-
</
|
| 8 |
</div>
|
| 9 |
-
Welcome to the Giskard Evaluator Space! Get a model vulnerability report immediately by simply sharing your model and dataset id below.
|
| 10 |
-
You can also checkout our library documentation <a href="https://docs.giskard.ai/en/latest/getting_started/quickstart/index.html">here</a>.
|
| 11 |
"""
|
| 12 |
CONFIRM_MAPPING_DETAILS_MD = """
|
| 13 |
<h1 style="text-align: center;">
|
|
|
|
| 1 |
EXAMPLE_MODEL_ID = "cardiffnlp/twitter-roberta-base-sentiment-latest"
|
| 2 |
|
| 3 |
+
TITLE_MD = """
|
| 4 |
+
<div style="display: flex; justify-content: center;">
|
| 5 |
+
<h1 style="text-align: center;">
|
| 6 |
+
🐢Giskard Evaluator
|
| 7 |
+
</h1>
|
| 8 |
+
</div>
|
| 9 |
+
Welcome to the Giskard Evaluator Space!
|
| 10 |
+
Get a model vulnerability report immediately and freely by simply providing the model and dataset id on Hugging Face.
|
| 11 |
+
You can also checkout our library documentation <a href="https://docs.giskard.ai/en/latest/getting_started/quickstart/index.html">here</a>.
|
| 12 |
+
<!-- Don’t hesitate to give the us a <a href="https://github.com/Giskard-AI/giskard">star on GitHub</a> ⭐️ if you find this work useful! -->
|
| 13 |
+
"""
|
| 14 |
+
|
| 15 |
+
FOOTER_HTML = """
|
| 16 |
+
<div style="display: flex; justify-content: center;">
|
| 17 |
+
<p style="text-align: center;">
|
| 18 |
+
This evaluator is built on top of <a href="https://github.com/Giskard-AI/giskard">Giskard Open Source library</a>
|
| 19 |
+
and <a href="https://github.com/Giskard-AI/cicd">Giskard CI/CD</a>.
|
| 20 |
+
<br/>
|
| 21 |
+
If you like our work, please give the projects ⭐️ star on GitHub.
|
| 22 |
+
</p>
|
| 23 |
+
</div>
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
INTRODUCTION_MD = """
|
| 27 |
<div style="display: flex; justify-content: center;">
|
| 28 |
+
<h2 style="text-align: center;">
|
| 29 |
+
Text Classification
|
| 30 |
+
</h2>
|
| 31 |
</div>
|
|
|
|
|
|
|
| 32 |
"""
|
| 33 |
CONFIRM_MAPPING_DETAILS_MD = """
|
| 34 |
<h1 style="text-align: center;">
|