eclipse-senpai commited on
Commit
409f522
·
1 Parent(s): 0cf2e33

Restore interactive Gradio UI (same-origin auth fixes quota); remove footer line

Browse files
Files changed (1) hide show
  1. app.py +26 -32
app.py CHANGED
@@ -140,42 +140,36 @@ button#gen:hover{ background:var(--blue-bright) !important; }
140
  .foot a:hover{ color:var(--text); }
141
  """
142
 
143
- # ── API-only backend ─────────────────────────────────────────────────────────
144
- # The interactive UI lives at MinimaLabs/min-spark-preview (static frontend,
145
- # calls /run_generate via @gradio/client). This Space only exposes the API.
146
- # Hidden inputs keep run_generate's signature wired so the endpoint persists.
147
- BACKEND_NOTICE = """
148
  <div class="head">
149
- <div class="title">min-spark <em>preview</em> · backend</div>
150
- <div class="sub">Minima Labs · API endpoint — no interactive UI here</div>
151
- </div>
152
- <div style="margin-top:16px; background:var(--surface); border:1px solid var(--hair);
153
- border-radius:10px; padding:18px 20px; font-size:14.5px; line-height:1.6;">
154
- This is the ZeroGPU inference backend for
155
- <a href="https://huggingface.co/spaces/MinimaLabs/min-spark-preview"
156
- style="color:#5E96FF;">MinimaLabs/min-spark-preview</a>.
157
- Use that Space to prompt the model — this one only serves the
158
- <code style="font-family:'IBM Plex Mono',monospace; font-size:12.5px;
159
- background:#16224A; padding:1px 6px; border-radius:4px;">/run_generate</code>
160
- API endpoint.
161
  </div>
162
  """
163
 
164
- with gr.Blocks(css=CSS, title="min-spark · Meiosis preview (backend)") as demo:
165
- gr.HTML(BACKEND_NOTICE)
166
-
167
- # Hidden API plumbing not rendered, but keeps /run_generate exposed.
168
- with gr.Row(visible=False):
169
- prompt = gr.Textbox(value="")
170
- effort = gr.Number(value=3)
171
- max_new = gr.Number(value=128)
172
- temperature = gr.Number(value=0.8)
173
- top_k = gr.Number(value=50)
174
- out = gr.Textbox(value="")
175
- status = gr.HTML(value="")
176
- api_btn = gr.Button("api")
177
-
178
- api_btn.click(
 
 
 
 
 
 
 
 
179
  fn=run_generate,
180
  inputs=[prompt, effort, max_new, temperature, top_k],
181
  outputs=[out, status],
 
140
  .foot a:hover{ color:var(--text); }
141
  """
142
 
143
+ HEADER_HTML = """
 
 
 
 
144
  <div class="head">
145
+ <div class="title">min-spark <em>preview</em></div>
146
+ <div class="sub">Minima Labs</div>
 
 
 
 
 
 
 
 
 
 
147
  </div>
148
  """
149
 
150
+ with gr.Blocks(css=CSS, title="min-spark · Meiosis preview") as demo:
151
+ gr.HTML(HEADER_HTML)
152
+
153
+ gr.HTML('<div class="field-h">Effortloops per token</div>')
154
+ effort = gr.Radio(choices=EFFORT_CHOICES, value=3, elem_id="effort",
155
+ show_label=False, container=False)
156
+
157
+ gr.HTML('<div class="field-h">Prompt</div>')
158
+ prompt = gr.Textbox(value="", placeholder="Once upon a time",
159
+ lines=2, show_label=False, container=False)
160
+
161
+ with gr.Row():
162
+ max_new = gr.Slider(8, 256, value=128, step=8, label="Max tokens")
163
+ temperature = gr.Slider(0.1, 1.6, value=0.8, step=0.05, label="Temperature")
164
+ top_k = gr.Slider(0, 200, value=50, step=5, label="Top-k (0 = off)") # infer.py default
165
+
166
+ gen_btn = gr.Button("Generate", elem_id="gen", variant="primary")
167
+
168
+ out = gr.Textbox(value="", elem_id="out", show_label=False, container=False,
169
+ lines=10, interactive=False, autoscroll=True)
170
+ status = gr.HTML(value='<div class="status"></div>')
171
+
172
+ gen_btn.click(
173
  fn=run_generate,
174
  inputs=[prompt, effort, max_new, temperature, top_k],
175
  outputs=[out, status],