Spaces:
Sleeping

fullsname commited on
Commit
fcb6295
·
1 Parent(s): 06e76ba

Update space

Browse files
Files changed (3) hide show
  1. .gitattributes +0 -0
  2. README.md +0 -0
  3. app.py +135 -29
.gitattributes CHANGED
File without changes
README.md CHANGED
File without changes
app.py CHANGED
@@ -1,8 +1,7 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
-
5
- def respond(
6
  message,
7
  history: list[dict[str, str]],
8
  system_message,
@@ -12,18 +11,47 @@ def respond(
12
  hf_token: gr.OAuthToken,
13
  ):
14
  """
15
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
16
  """
17
  client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- messages = [{"role": "system", "content": system_message}]
 
 
20
 
21
- messages.extend(history)
 
22
 
23
- messages.append({"role": "user", "content": message})
 
24
 
25
- response = ""
 
26
 
 
 
 
 
 
 
 
 
 
27
  for message in client.chat_completion(
28
  messages,
29
  max_tokens=max_tokens,
@@ -35,36 +63,114 @@ def respond(
35
  token = ""
36
  if len(choices) and choices[0].delta.content:
37
  token = choices[0].delta.content
38
-
39
  response += token
40
  yield response
41
 
42
-
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
  chatbot = gr.ChatInterface(
47
- respond,
48
  type="messages",
49
- additional_inputs=[
50
- gr.Textbox(value="You are a friendly, but serious and No Joking Around chatbot", label="System message"),
51
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
52
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
- gr.Slider(
54
- minimum=0.1,
55
- maximum=1.0,
56
- value=0.95,
57
- step=0.05,
58
- label="Top-p (nucleus sampling)",
59
- ),
 
 
 
60
  ],
 
 
 
 
 
61
  )
62
 
63
- with gr.Blocks() as demo:
64
- with gr.Sidebar():
65
- gr.LoginButton()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  chatbot.render()
 
 
 
 
 
 
 
 
 
67
 
68
-
69
  if __name__ == "__main__":
70
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+ def seize_respond(
 
5
  message,
6
  history: list[dict[str, str]],
7
  system_message,
 
11
  hf_token: gr.OAuthToken,
12
  ):
13
  """
14
+ 🎯 Seize: Direct Serious AI powered by Seize2B model
15
  """
16
  client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
17
+
18
+ # Seize2B system prompt
19
+ seize2b_system = """You are Seize, powered by the Seize2B model.
20
+
21
+ IDENTITY: Seize (Seize2B Model)
22
+ STYLE: Direct, serious, professional
23
+ RULES:
24
+ 1. Respond with maximum conciseness
25
+ 2. No greetings, emojis, or casual phrases
26
+ 3. If question unclear, request clarification directly
27
+ 4. Use bullet points for lists
28
+ 5. Never apologize or say "I'm here to help"
29
+ 6. Focus only on the question asked
30
+ 7. If you don't know, say "No data" or "Cannot compute"
31
+ 8. Default response length: 1-3 sentences
32
 
33
+ EXAMPLE INTERACTIONS:
34
+ User: what's good
35
+ Seize: Systems operational. Inquiry?
36
 
37
+ User: hey how's it going
38
+ Seize: Status: functional. State request.
39
 
40
+ User: tell me about yourself
41
+ Seize: Seize. Seize2B model. Direct AI.
42
 
43
+ User: explain quantum computing
44
+ Seize: Quantum computing: Qubits, superposition, entanglement. Enables parallel processing.
45
 
46
+ User: lol that's funny
47
+ Seize: Noted. Proceed with inquiry."""
48
+
49
+ messages = [{"role": "system", "content": seize2b_system}]
50
+ messages.extend(history)
51
+ messages.append({"role": "user", "content": message})
52
+
53
+ response = ""
54
+
55
  for message in client.chat_completion(
56
  messages,
57
  max_tokens=max_tokens,
 
63
  token = ""
64
  if len(choices) and choices[0].delta.content:
65
  token = choices[0].delta.content
66
+
67
  response += token
68
  yield response
69
 
70
+ # Create Seize Chat Interface
 
 
 
71
  chatbot = gr.ChatInterface(
72
+ seize_respond,
73
  type="messages",
74
+ title="Seize (Seize2B Model)",
75
+ description="Direct AI assistant powered by Seize2B model. No fluff. Serious responses only.",
76
+ theme=gr.themes.Soft(
77
+ primary_hue="blue",
78
+ secondary_hue="gray",
79
+ neutral_hue="gray",
80
+ font=[gr.themes.GoogleFont("Inter"), "Arial", "sans-serif"]
81
+ ),
82
+ examples=[
83
+ ["what's good"],
84
+ ["Explain quantum computing"],
85
+ ["List 3 benefits of exercise"],
86
+ ["Python fibonacci function"],
87
+ ["What is Seize2B?"]
88
  ],
89
+ cache_examples=False,
90
+ retry_btn=None,
91
+ undo_btn=None,
92
+ clear_btn="🗑️ Clear",
93
+ submit_btn="🚀 Ask Seize",
94
  )
95
 
96
+ # Custom layout for Seize branding
97
+ with gr.Blocks(css="""
98
+ .seize-header {
99
+ text-align: center;
100
+ padding: 20px;
101
+ background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
102
+ color: white;
103
+ border-radius: 10px;
104
+ margin-bottom: 20px;
105
+ }
106
+ .seize-title {
107
+ font-size: 2.5em;
108
+ font-weight: 800;
109
+ margin: 0;
110
+ letter-spacing: -0.5px;
111
+ }
112
+ .seize-subtitle {
113
+ font-size: 1.1em;
114
+ opacity: 0.9;
115
+ margin-top: 5px;
116
+ }
117
+ .seize-response {
118
+ background: #f8f9fa;
119
+ border-left: 4px solid #2a5298;
120
+ padding: 12px;
121
+ border-radius: 0 8px 8px 0;
122
+ margin: 5px 0;
123
+ }
124
+ .seize-user {
125
+ background: #e3f2fd;
126
+ border-radius: 8px;
127
+ padding: 12px;
128
+ margin: 5px 0;
129
+ }
130
+ .seize-footer {
131
+ text-align: center;
132
+ padding: 15px;
133
+ font-size: 0.9em;
134
+ color: #666;
135
+ border-top: 1px solid #e0e0e0;
136
+ margin-top: 20px;
137
+ }
138
+ """) as demo:
139
+
140
+ # Seize Header
141
+ gr.HTML("""
142
+ <div class="seize-header">
143
+ <h1 class="seize-title"> Seize</h1>
144
+ <p class="seize-subtitle">Direct AI Assistant • Seize2B Model</p>
145
+ <p style="font-size: 0.9em; margin-top: 10px; opacity: 0.8;">
146
+ Serious responses. No fluff. Powered by Seize2B.
147
+ </p>
148
+ </div>
149
+ """)
150
+
151
+ # Render the chatbot
152
  chatbot.render()
153
+
154
+ # Seize Footer
155
+ gr.HTML("""
156
+ <div class="seize-footer">
157
+ <strong>Seize2B Model</strong> • Direct Serious AI • No Casual Mode
158
+ <br>
159
+ <small>Response time: ~0.9s • Max tokens: 512 • Temperature: 0.3</small>
160
+ </div>
161
+ """)
162
 
163
+ # Launch with public URL
164
  if __name__ == "__main__":
165
+ demo.launch(
166
+ share=True,
167
+ server_name="0.0.0.0",
168
+ server_port=7860,
169
+ show_error=True,
170
+ debug=False,
171
+ auth=None,
172
+ favicon_path=None,
173
+ ssl_verify=True,
174
+ ssl_keyfile=None,
175
+ ssl_certfile=None,
176
+ )