eddddyy commited on
Commit
3b42523
·
verified ·
1 Parent(s): ecfd85f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -10,7 +10,7 @@ def smart_response(command, execute):
10
  # Dynamically adjust max_new_tokens based on complexity
11
  simple_keywords = ["open", "close", "shutdown", "restart", "lock", "screenshot"]
12
  is_simple = any(keyword in command.lower() for keyword in simple_keywords)
13
- max_tokens = 128 if is_simple else 1024 # fast for simple, detailed for complex
14
 
15
  return get_assistant_response(pipe, command, execute, max_new_tokens=max_tokens)
16
 
@@ -18,16 +18,25 @@ def smart_response(command, execute):
18
  demo = gr.Interface(
19
  fn=smart_response,
20
  inputs=[
21
- gr.Textbox(lines=2, placeholder="e.g. Open Chrome or Take a screenshot", label="🧾 Command"),
 
 
 
 
22
  gr.Checkbox(label="🛠️ Execute command (if possible)")
23
  ],
24
  outputs="text",
25
  title="🧠 Smart AI Assistant",
26
  description=(
27
- "AI assistant powered by google/medgemma-4b-it\n\n"
28
- "Try commands like: 'Open Chrome', 'Take a screenshot', 'Create a file', or 'What is AI?'\n"
29
- "✔️ Short commands = fast responses | 🧠 Big questions = detailed answers\n"
30
- " Enable the checkbox to let it run real OS commands (where allowed)"
 
 
 
 
 
31
  ),
32
  flagging_mode="never"
33
  )
 
10
  # Dynamically adjust max_new_tokens based on complexity
11
  simple_keywords = ["open", "close", "shutdown", "restart", "lock", "screenshot"]
12
  is_simple = any(keyword in command.lower() for keyword in simple_keywords)
13
+ max_tokens = 128 if is_simple else 1024 # Shorter for quick commands, longer for reasoning
14
 
15
  return get_assistant_response(pipe, command, execute, max_new_tokens=max_tokens)
16
 
 
18
  demo = gr.Interface(
19
  fn=smart_response,
20
  inputs=[
21
+ gr.Textbox(
22
+ lines=2,
23
+ placeholder="e.g. Open Chrome or Take a screenshot",
24
+ label="🧾 Command"
25
+ ),
26
  gr.Checkbox(label="🛠️ Execute command (if possible)")
27
  ],
28
  outputs="text",
29
  title="🧠 Smart AI Assistant",
30
  description=(
31
+ "AI assistant powered by **Mistral-7B-Instruct** 🧠\n\n"
32
+ "Try commands like:\n"
33
+ " 'Open Chrome'\n"
34
+ " 'Take a screenshot'\n"
35
+ "• 'What is AGI?'\n"
36
+ "• 'Summarize the history of AI'\n\n"
37
+ "✅ Simple commands → fast replies\n"
38
+ "🧠 Complex questions → thoughtful answers\n"
39
+ "⚠️ Check the box to allow real OS command execution"
40
  ),
41
  flagging_mode="never"
42
  )