Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Clod keeps every "Claudism" and none of the intelligence: confidently wrong, extremely polite, and its thinking is
|
| 4 |
just "hmm". The thinking toggle maps to Qwen3.5's enable_thinking switch; the thinking text is shown in a collapsible
|
| 5 |
bubble above the reply, because the contrast between the thought and the answer is the joke.
|
| 6 |
-
MODEL_ID picks the model (devon7y/Clod
|
| 7 |
"""
|
| 8 |
import os, re, threading
|
| 9 |
import gradio as gr
|
|
@@ -12,8 +12,9 @@ if os.environ.get("CLOD_FAKE") != "1":
|
|
| 12 |
import torch
|
| 13 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
| 14 |
|
| 15 |
-
MODEL_ID = os.environ.get("MODEL_ID", "devon7y/Clod
|
| 16 |
-
MODEL_TAG = os.environ.get("MODEL_TAG",
|
|
|
|
| 17 |
GPU_SECONDS = int(os.environ.get("GPU_SECONDS", "60"))
|
| 18 |
MAX_NEW = int(os.environ.get("MAX_NEW", "900"))
|
| 19 |
MAX_HISTORY_TURNS = 8
|
|
@@ -183,7 +184,7 @@ def generate_api(message, history, think, temperature):
|
|
| 183 |
# A parody of the stock claude.ai look: warm paper background, serif replies, a big time-of-day greeting, a white
|
| 184 |
# composer card with a model picker and a thinking toggle, a "Recents" sidebar. The mark is not Anthropic's: it is a
|
| 185 |
# lumpy, mud-coloured starburst with one ray broken off and a crumb falling out of it.
|
| 186 |
-
MODEL_BLURB = {"9B": "Most annoying model for complex nonsense", "4B": "Fastest model for everyday nonsense"}
|
| 187 |
|
| 188 |
|
| 189 |
def clod_mark(size=32, cls="cl-mark"):
|
|
@@ -283,11 +284,11 @@ CHEVRON = ('<svg class="cl-chev" width="12" height="12" viewBox="0 0 12 12" aria
|
|
| 283 |
'stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>')
|
| 284 |
PICKER = f"""
|
| 285 |
<details class="cl-picker">
|
| 286 |
-
<summary>
|
| 287 |
<div class="cl-menu">
|
| 288 |
<div class="cl-menu-item cl-disabled"><div><b>Clod Fable <em class="cl-max">Max</em></b><span>Our most capable model. Every answer is a fable.</span></div></div>
|
| 289 |
<div class="cl-menu-item cl-disabled"><div><b>Clod Opus</b><span>Coming never</span></div></div>
|
| 290 |
-
<div class="cl-menu-item cl-current"><div><b>
|
| 291 |
<div class="cl-menu-item cl-disabled"><div><b>Clod Haiku</b><span class="cl-haiku">Quick, confident, wrong<br>seventeen syllables of<br>load-bearing nonsense</span></div></div>
|
| 292 |
</div>
|
| 293 |
</details>
|
|
@@ -623,7 +624,7 @@ THEME = gr.themes.Base(primary_hue="orange", neutral_hue="stone", font=[gr.theme
|
|
| 623 |
block_label_text_color="#7d7a70", block_label_text_color_dark="#7d7a70", button_primary_background_fill="#b5613b", button_primary_background_fill_dark="#b5613b",
|
| 624 |
)
|
| 625 |
|
| 626 |
-
with gr.Blocks(title=
|
| 627 |
with gr.Row(elem_id="cl-shell", equal_height=False):
|
| 628 |
with gr.Column(elem_id="cl-side", scale=0, min_width=248):
|
| 629 |
gr.HTML(SIDEBAR)
|
|
|
|
| 3 |
Clod keeps every "Claudism" and none of the intelligence: confidently wrong, extremely polite, and its thinking is
|
| 4 |
just "hmm". The thinking toggle maps to Qwen3.5's enable_thinking switch; the thinking text is shown in a collapsible
|
| 5 |
bubble above the reply, because the contrast between the thought and the answer is the joke.
|
| 6 |
+
MODEL_ID picks the model (default devon7y/Clod, the 9B); everything else is fixed.
|
| 7 |
"""
|
| 8 |
import os, re, threading
|
| 9 |
import gradio as gr
|
|
|
|
| 12 |
import torch
|
| 13 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
| 14 |
|
| 15 |
+
MODEL_ID = os.environ.get("MODEL_ID", "devon7y/Clod")
|
| 16 |
+
MODEL_TAG = os.environ.get("MODEL_TAG", "") # e.g. "4B"; empty for the flagship, shown as plain "Clod"
|
| 17 |
+
MODEL_NAME = f"Clod {MODEL_TAG}".strip()
|
| 18 |
GPU_SECONDS = int(os.environ.get("GPU_SECONDS", "60"))
|
| 19 |
MAX_NEW = int(os.environ.get("MAX_NEW", "900"))
|
| 20 |
MAX_HISTORY_TURNS = 8
|
|
|
|
| 184 |
# A parody of the stock claude.ai look: warm paper background, serif replies, a big time-of-day greeting, a white
|
| 185 |
# composer card with a model picker and a thinking toggle, a "Recents" sidebar. The mark is not Anthropic's: it is a
|
| 186 |
# lumpy, mud-coloured starburst with one ray broken off and a crumb falling out of it.
|
| 187 |
+
MODEL_BLURB = {"": "Most annoying model for complex nonsense", "9B": "Most annoying model for complex nonsense", "4B": "Fastest model for everyday nonsense"}
|
| 188 |
|
| 189 |
|
| 190 |
def clod_mark(size=32, cls="cl-mark"):
|
|
|
|
| 284 |
'stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>')
|
| 285 |
PICKER = f"""
|
| 286 |
<details class="cl-picker">
|
| 287 |
+
<summary>{MODEL_NAME}{CHEVRON}</summary>
|
| 288 |
<div class="cl-menu">
|
| 289 |
<div class="cl-menu-item cl-disabled"><div><b>Clod Fable <em class="cl-max">Max</em></b><span>Our most capable model. Every answer is a fable.</span></div></div>
|
| 290 |
<div class="cl-menu-item cl-disabled"><div><b>Clod Opus</b><span>Coming never</span></div></div>
|
| 291 |
+
<div class="cl-menu-item cl-current"><div><b>{MODEL_NAME}</b><span>{MODEL_BLURB.get(MODEL_TAG, '')}</span></div><i>✓</i></div>
|
| 292 |
<div class="cl-menu-item cl-disabled"><div><b>Clod Haiku</b><span class="cl-haiku">Quick, confident, wrong<br>seventeen syllables of<br>load-bearing nonsense</span></div></div>
|
| 293 |
</div>
|
| 294 |
</details>
|
|
|
|
| 624 |
block_label_text_color="#7d7a70", block_label_text_color_dark="#7d7a70", button_primary_background_fill="#b5613b", button_primary_background_fill_dark="#b5613b",
|
| 625 |
)
|
| 626 |
|
| 627 |
+
with gr.Blocks(title=MODEL_NAME) as demo:
|
| 628 |
with gr.Row(elem_id="cl-shell", equal_height=False):
|
| 629 |
with gr.Column(elem_id="cl-side", scale=0, min_width=248):
|
| 630 |
gr.HTML(SIDEBAR)
|