Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,10 +11,10 @@ classifier = load_model("ngocminhta/authscan-baseline")
|
|
| 11 |
classifier2 = load_model("ngocminhta/authscan-baseline-machine")
|
| 12 |
|
| 13 |
TEXT_CLASS_MAPPING_MACHINE = {
|
| 14 |
-
'LABEL_0': 'Gemini 1.5
|
| 15 |
-
'LABEL_1': 'Gemini 2.0
|
| 16 |
-
'LABEL_2': 'GPT-4o
|
| 17 |
-
'LABEL_3': 'Llama 3.1
|
| 18 |
}
|
| 19 |
|
| 20 |
TEXT_CLASS_MAPPING = {
|
|
@@ -49,53 +49,16 @@ def process_result_detection_tab(text, language):
|
|
| 49 |
|
| 50 |
def clear_detection_tab():
|
| 51 |
return "", gr.update(interactive=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
body.dark-mode {
|
| 55 |
-
background-color: #2c2c2c;
|
| 56 |
-
color: white;
|
| 57 |
-
}
|
| 58 |
-
body.light-mode {
|
| 59 |
-
background-color: white;
|
| 60 |
-
color: black;
|
| 61 |
-
}
|
| 62 |
-
#dark-mode-toggle {
|
| 63 |
-
position: fixed;
|
| 64 |
-
top: 10px;
|
| 65 |
-
right: 10px;
|
| 66 |
-
z-index: 1000;
|
| 67 |
-
padding: 10px 15px;
|
| 68 |
-
background-color: #007bff;
|
| 69 |
-
color: white;
|
| 70 |
-
border: none;
|
| 71 |
-
border-radius: 5px;
|
| 72 |
-
cursor: pointer;
|
| 73 |
-
font-size: 14px;
|
| 74 |
-
}
|
| 75 |
-
#dark-mode-toggle:hover {
|
| 76 |
-
background-color: #0056b3;
|
| 77 |
-
}
|
| 78 |
-
"""
|
| 79 |
-
|
| 80 |
-
js = """
|
| 81 |
-
function toggleDarkMode() {
|
| 82 |
-
const body = document.body;
|
| 83 |
-
if (body.classList.contains('dark-mode')) {
|
| 84 |
-
body.classList.remove('dark-mode');
|
| 85 |
-
body.classList.add('light-mode');
|
| 86 |
-
} else {
|
| 87 |
-
body.classList.remove('light-mode');
|
| 88 |
-
body.classList.add('dark-mode');
|
| 89 |
-
}
|
| 90 |
-
}
|
| 91 |
-
"""
|
| 92 |
-
|
| 93 |
-
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 94 |
gr.Markdown("""<h1><center>AuthScan</center></h1>""")
|
| 95 |
-
|
| 96 |
-
gr.HTML(
|
| 97 |
-
'<button id="dark-mode-toggle" onclick="toggleDarkMode()">Switch</button>'
|
| 98 |
-
)
|
| 99 |
with gr.Tab("Code Detection"):
|
| 100 |
with gr.Row():
|
| 101 |
language = gr.Dropdown(
|
|
|
|
| 11 |
classifier2 = load_model("ngocminhta/authscan-baseline-machine")
|
| 12 |
|
| 13 |
TEXT_CLASS_MAPPING_MACHINE = {
|
| 14 |
+
'LABEL_0': 'Gemini 1.5 Family',
|
| 15 |
+
'LABEL_1': 'Gemini 2.0 Family',
|
| 16 |
+
'LABEL_2': 'GPT-4o Family',
|
| 17 |
+
'LABEL_3': 'Llama 3.1 Family'
|
| 18 |
}
|
| 19 |
|
| 20 |
TEXT_CLASS_MAPPING = {
|
|
|
|
| 49 |
|
| 50 |
def clear_detection_tab():
|
| 51 |
return "", gr.update(interactive=False)
|
| 52 |
+
|
| 53 |
+
theme = gr.themes.Soft(
|
| 54 |
+
primary_hue="teal",
|
| 55 |
+
font=[gr.themes.GoogleFont('Open Sans'), 'ui-sans-serif', 'system-ui', 'sans-serif'],
|
| 56 |
+
font_mono=[gr.themes.GoogleFont('Roboto Mono'), 'ui-monospace', 'Consolas', 'monospace'],
|
| 57 |
+
)
|
| 58 |
|
| 59 |
+
with gr.Blocks(theme=theme) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
gr.Markdown("""<h1><center>AuthScan</center></h1>""")
|
| 61 |
+
|
|
|
|
|
|
|
|
|
|
| 62 |
with gr.Tab("Code Detection"):
|
| 63 |
with gr.Row():
|
| 64 |
language = gr.Dropdown(
|