Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ def call_kgx3(title, email, pdf_file, agreement):
|
|
| 24 |
# Build the Hugging Face Space file URL
|
| 25 |
space_root = gr.get_current_space() or "https://your-space-name.hf.space"
|
| 26 |
file_name = pathlib.Path(pdf_path).name
|
| 27 |
-
file_url
|
| 28 |
|
| 29 |
headers = {"X-API-Key": API_KEY, "Content-Type": "application/json"}
|
| 30 |
payload = {
|
|
@@ -47,50 +47,67 @@ def call_kgx3(title, email, pdf_file, agreement):
|
|
| 47 |
|
| 48 |
|
| 49 |
# === STYLE (modern dark, clear contrast) ===
|
| 50 |
-
|
| 51 |
-
/* ===
|
| 52 |
* {
|
| 53 |
font-family: 'Courier New', monospace !important;
|
| 54 |
color: #00ff99 !important;
|
| 55 |
box-sizing: border-box;
|
| 56 |
}
|
|
|
|
| 57 |
body, .gradio-container {
|
| 58 |
background-color: #000 !important;
|
| 59 |
color: #00ff99 !important;
|
| 60 |
}
|
| 61 |
|
| 62 |
-
/* ===
|
| 63 |
h1, h2, h3, label, .label {
|
| 64 |
color: #00ff99 !important;
|
| 65 |
-
font-weight:
|
| 66 |
text-transform: uppercase;
|
| 67 |
-
letter-spacing:
|
|
|
|
| 68 |
border-bottom: 1px solid #00ff99;
|
| 69 |
-
margin-bottom: 6px;
|
| 70 |
padding-bottom: 4px;
|
| 71 |
}
|
| 72 |
-
p, span, small { color: #00ff99 !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
/* === INPUTS & TEXTAREAS === */
|
| 75 |
-
input, textarea {
|
| 76 |
background: #000 !important;
|
| 77 |
border: 1px solid #00ff99 !important;
|
| 78 |
color: #00ff99 !important;
|
| 79 |
-
border-radius:
|
| 80 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
-
::placeholder { color: #00ff99 !important; opacity: 0.6; }
|
| 83 |
|
| 84 |
-
/* ===
|
| 85 |
.upload-box, .file-preview, .wrap-inner {
|
| 86 |
background: #000 !important;
|
| 87 |
border: 2px solid #00ff99 !important;
|
| 88 |
border-radius: 6px !important;
|
| 89 |
-
padding:
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
| 92 |
}
|
| 93 |
.upload-box:hover {
|
|
|
|
| 94 |
background: #001a10 !important;
|
| 95 |
}
|
| 96 |
|
|
@@ -100,46 +117,49 @@ button {
|
|
| 100 |
color: #00ff99 !important;
|
| 101 |
border: 2px solid #00ff99 !important;
|
| 102 |
border-radius: 4px;
|
| 103 |
-
padding: 8px 16px !important;
|
| 104 |
-
font-weight: bold;
|
| 105 |
text-transform: uppercase;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
button:hover {
|
| 108 |
background: #00ff99 !important;
|
| 109 |
color: #000 !important;
|
| 110 |
}
|
| 111 |
|
| 112 |
-
/* ===
|
| 113 |
pre, code, .cm-editor, .cm-content, .cm-line {
|
| 114 |
background: #000 !important;
|
| 115 |
color: #00ff99 !important;
|
| 116 |
border: 1px solid #00ff99 !important;
|
| 117 |
-
border-radius:
|
|
|
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
-
/* ===
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
background: #000 !important;
|
| 125 |
-
padding: 12px;
|
| 126 |
}
|
| 127 |
|
| 128 |
/* === SCROLLBARS === */
|
| 129 |
::-webkit-scrollbar { width: 8px; background: #000; }
|
| 130 |
::-webkit-scrollbar-thumb { background: #00ff99; border-radius: 4px; }
|
| 131 |
|
| 132 |
-
/* ===
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
"""
|
| 138 |
|
| 139 |
|
| 140 |
-
|
| 141 |
# === BUILD APP ===
|
| 142 |
-
with gr.Blocks(css=
|
| 143 |
gr.Markdown(
|
| 144 |
"""
|
| 145 |
# 🧠 **KGX3 Engine**
|
|
|
|
| 24 |
# Build the Hugging Face Space file URL
|
| 25 |
space_root = gr.get_current_space() or "https://your-space-name.hf.space"
|
| 26 |
file_name = pathlib.Path(pdf_path).name
|
| 27 |
+
file_url = f"{gr.get_current_space()}/file={pathlib.Path(pdf_file.name).name}"
|
| 28 |
|
| 29 |
headers = {"X-API-Key": API_KEY, "Content-Type": "application/json"}
|
| 30 |
payload = {
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
# === STYLE (modern dark, clear contrast) ===
|
| 50 |
+
FUTURE_CSS = """
|
| 51 |
+
/* === UNIVERSAL BASE === */
|
| 52 |
* {
|
| 53 |
font-family: 'Courier New', monospace !important;
|
| 54 |
color: #00ff99 !important;
|
| 55 |
box-sizing: border-box;
|
| 56 |
}
|
| 57 |
+
|
| 58 |
body, .gradio-container {
|
| 59 |
background-color: #000 !important;
|
| 60 |
color: #00ff99 !important;
|
| 61 |
}
|
| 62 |
|
| 63 |
+
/* === HEADINGS & TEXT === */
|
| 64 |
h1, h2, h3, label, .label {
|
| 65 |
color: #00ff99 !important;
|
| 66 |
+
font-weight: 700 !important;
|
| 67 |
text-transform: uppercase;
|
| 68 |
+
letter-spacing: 0.5px;
|
| 69 |
+
margin-bottom: 8px;
|
| 70 |
border-bottom: 1px solid #00ff99;
|
|
|
|
| 71 |
padding-bottom: 4px;
|
| 72 |
}
|
| 73 |
+
p, span, small, strong { color: #00ff99 !important; }
|
| 74 |
+
::placeholder { color: #00ff99 !important; opacity: 0.7; }
|
| 75 |
+
|
| 76 |
+
/* === PANELS & CONTAINERS === */
|
| 77 |
+
.gr-box, .gr-panel {
|
| 78 |
+
background: #000 !important;
|
| 79 |
+
border: 1px solid #00ff99 !important;
|
| 80 |
+
border-radius: 8px;
|
| 81 |
+
padding: 12px;
|
| 82 |
+
}
|
| 83 |
|
| 84 |
/* === INPUTS & TEXTAREAS === */
|
| 85 |
+
input, textarea, select {
|
| 86 |
background: #000 !important;
|
| 87 |
border: 1px solid #00ff99 !important;
|
| 88 |
color: #00ff99 !important;
|
| 89 |
+
border-radius: 4px;
|
| 90 |
+
padding: 8px !important;
|
| 91 |
+
}
|
| 92 |
+
input:focus, textarea:focus {
|
| 93 |
+
outline: none !important;
|
| 94 |
+
border: 1px solid #00ffcc !important;
|
| 95 |
+
background: #001a10 !important;
|
| 96 |
}
|
|
|
|
| 97 |
|
| 98 |
+
/* === FILE UPLOAD BOX === */
|
| 99 |
.upload-box, .file-preview, .wrap-inner {
|
| 100 |
background: #000 !important;
|
| 101 |
border: 2px solid #00ff99 !important;
|
| 102 |
border-radius: 6px !important;
|
| 103 |
+
padding: 10px !important;
|
| 104 |
+
display: flex !important;
|
| 105 |
+
align-items: center !important;
|
| 106 |
+
justify-content: center !important;
|
| 107 |
+
transition: all 0.2s ease-in-out;
|
| 108 |
}
|
| 109 |
.upload-box:hover {
|
| 110 |
+
border-color: #00ffaa !important;
|
| 111 |
background: #001a10 !important;
|
| 112 |
}
|
| 113 |
|
|
|
|
| 117 |
color: #00ff99 !important;
|
| 118 |
border: 2px solid #00ff99 !important;
|
| 119 |
border-radius: 4px;
|
|
|
|
|
|
|
| 120 |
text-transform: uppercase;
|
| 121 |
+
font-weight: 700;
|
| 122 |
+
padding: 8px 16px !important;
|
| 123 |
+
letter-spacing: 0.5px;
|
| 124 |
+
transition: all 0.15s ease-in-out;
|
| 125 |
}
|
| 126 |
button:hover {
|
| 127 |
background: #00ff99 !important;
|
| 128 |
color: #000 !important;
|
| 129 |
}
|
| 130 |
|
| 131 |
+
/* === CODE / OUTPUT BOX === */
|
| 132 |
pre, code, .cm-editor, .cm-content, .cm-line {
|
| 133 |
background: #000 !important;
|
| 134 |
color: #00ff99 !important;
|
| 135 |
border: 1px solid #00ff99 !important;
|
| 136 |
+
border-radius: 6px;
|
| 137 |
+
padding: 10px !important;
|
| 138 |
+
font-size: 0.9rem;
|
| 139 |
}
|
| 140 |
|
| 141 |
+
/* === CHECKBOX === */
|
| 142 |
+
input[type=checkbox] {
|
| 143 |
+
accent-color: #00ff99 !important;
|
| 144 |
+
transform: scale(1.1);
|
|
|
|
|
|
|
| 145 |
}
|
| 146 |
|
| 147 |
/* === SCROLLBARS === */
|
| 148 |
::-webkit-scrollbar { width: 8px; background: #000; }
|
| 149 |
::-webkit-scrollbar-thumb { background: #00ff99; border-radius: 4px; }
|
| 150 |
|
| 151 |
+
/* === FOOTER TEXT === */
|
| 152 |
+
footer, .footer, small {
|
| 153 |
+
color: #00ff99 !important;
|
| 154 |
+
opacity: 0.8;
|
| 155 |
+
text-align: center;
|
| 156 |
+
letter-spacing: 0.4px;
|
| 157 |
}
|
| 158 |
"""
|
| 159 |
|
| 160 |
|
|
|
|
| 161 |
# === BUILD APP ===
|
| 162 |
+
with gr.Blocks(css=FUTURE_CSS, title="Shared KGX3 API Endpoint") as demo:
|
| 163 |
gr.Markdown(
|
| 164 |
"""
|
| 165 |
# 🧠 **KGX3 Engine**
|