Aobangaming commited on
Commit
0af7eb0
·
verified ·
1 Parent(s): c44f7ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -18
app.py CHANGED
@@ -3,30 +3,31 @@ import torch
3
  import ai_thingy
4
 
5
 
6
- def respond(message, history, system_message, max_tokens, temperature, top_k):
 
 
 
7
 
8
- # --- AOBANCORP™ AUTO-AWAKEN ---
9
- if ai_thingy.current_model is None:
10
- print("[SYSTEM] Loading Aoban 1.1A-Refined...")
11
 
12
- ai_thingy.device = torch.device("cpu")
 
 
 
 
13
 
14
- ai_thingy.initialize_or_retrain(
15
- initial_train=True,
16
- use_live_data=False,
17
- epochs=0
18
- )
19
 
20
- print("[SYSTEM] Aoban 1.1A-Refined loaded.")
21
 
22
- # --- PROMPT ---
 
23
  full_prompt = (
24
  f"{system_message}\n"
25
  f"User: {message}\n"
26
  f"Assistant:"
27
  )
28
 
29
- # --- GENERATION ---
30
  response = ai_thingy.generate_text(
31
  model=ai_thingy.current_model,
32
  tokenizer=ai_thingy.current_tokenizer,
@@ -48,22 +49,25 @@ demo = gr.ChatInterface(
48
  additional_inputs=[
49
  gr.Textbox(
50
  value="You are a helpful but not really helpful AobanCorp™ assistant.",
51
- label="An Aoban label"
52
  ),
53
  gr.Slider(
54
- 10, 100,
 
55
  value=50,
56
  step=1,
57
  label="Response Length"
58
  ),
59
  gr.Slider(
60
- 0.1, 2.0,
 
61
  value=1.0,
62
  step=0.1,
63
- label="Creativity (Temp)"
64
  ),
65
  gr.Slider(
66
- 1, 100,
 
67
  value=40,
68
  step=1,
69
  label="Focus (Top-K)"
 
3
  import ai_thingy
4
 
5
 
6
+ # Hugging Face Spaces can use CPU unless you've
7
+ # explicitly enabled a GPU.
8
+ ai_thingy.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
9
+
10
 
11
+ print("[SYSTEM] Initializing Aoban 1.1A-Refined...")
12
+ print(f"[SYSTEM] Device: {ai_thingy.device}")
 
13
 
14
+ ai_thingy.initialize_or_retrain(
15
+ initial_train=True,
16
+ use_live_data=False,
17
+ epochs=0
18
+ )
19
 
20
+ print("[SYSTEM] Aoban 1.1A-Refined is ready.")
 
 
 
 
21
 
 
22
 
23
+ def respond(message, history, system_message, max_tokens, temperature, top_k):
24
+
25
  full_prompt = (
26
  f"{system_message}\n"
27
  f"User: {message}\n"
28
  f"Assistant:"
29
  )
30
 
 
31
  response = ai_thingy.generate_text(
32
  model=ai_thingy.current_model,
33
  tokenizer=ai_thingy.current_tokenizer,
 
49
  additional_inputs=[
50
  gr.Textbox(
51
  value="You are a helpful but not really helpful AobanCorp™ assistant.",
52
+ label="Aoban System Prompt"
53
  ),
54
  gr.Slider(
55
+ minimum=10,
56
+ maximum=100,
57
  value=50,
58
  step=1,
59
  label="Response Length"
60
  ),
61
  gr.Slider(
62
+ minimum=0.1,
63
+ maximum=2.0,
64
  value=1.0,
65
  step=0.1,
66
+ label="Creativity (Temperature)"
67
  ),
68
  gr.Slider(
69
+ minimum=1,
70
+ maximum=100,
71
  value=40,
72
  step=1,
73
  label="Focus (Top-K)"