X34o commited on
Commit
ca50963
·
verified ·
1 Parent(s): 6785c0e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
3
  import torch
4
 
5
- model_name = "deepseek-ai/deepseek-coder-6.7b-instruct"
6
 
7
  bnb_config = BitsAndBytesConfig(
8
  load_in_4bit=True,
@@ -22,10 +22,8 @@ model = AutoModelForCausalLM.from_pretrained(
22
  model.eval()
23
 
24
  def generate_code(prompt):
25
- # Format prompt manual — tidak pakai apply_chat_template
26
  formatted = f"### Instruction:\n{prompt}\n### Response:\n"
27
 
28
- # Tokenize langsung jadi tensor
29
  inputs = tokenizer(
30
  formatted,
31
  return_tensors="pt",
@@ -47,7 +45,6 @@ def generate_code(prompt):
47
  eos_token_id=tokenizer.eos_token_id
48
  )
49
 
50
- # Ambil hanya jawaban baru
51
  new_tokens = output[0][input_ids.shape[-1]:]
52
  result = tokenizer.decode(new_tokens, skip_special_tokens=True)
53
  return result.strip()
@@ -60,6 +57,6 @@ gr.Interface(
60
  placeholder="Contoh: buatkan fungsi Python untuk REST API"
61
  ),
62
  outputs=gr.Code(label="Hasil kode", language="python"),
63
- title="Coding Assistant",
64
- description="Powered by DeepSeek Coder 6.7B (4-bit)"
65
  ).launch()
 
2
  from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
3
  import torch
4
 
5
+ model_name = "DavidAU/Qwen3.5-4B-Claude-4.6-OS-Auto-Variable-HERETIC-UNCENSORED-THINKING"
6
 
7
  bnb_config = BitsAndBytesConfig(
8
  load_in_4bit=True,
 
22
  model.eval()
23
 
24
  def generate_code(prompt):
 
25
  formatted = f"### Instruction:\n{prompt}\n### Response:\n"
26
 
 
27
  inputs = tokenizer(
28
  formatted,
29
  return_tensors="pt",
 
45
  eos_token_id=tokenizer.eos_token_id
46
  )
47
 
 
48
  new_tokens = output[0][input_ids.shape[-1]:]
49
  result = tokenizer.decode(new_tokens, skip_special_tokens=True)
50
  return result.strip()
 
57
  placeholder="Contoh: buatkan fungsi Python untuk REST API"
58
  ),
59
  outputs=gr.Code(label="Hasil kode", language="python"),
60
+ title="Coding Assistant - Uncensored",
61
+ description="Powered by Qwen3.5-4B Uncensored"
62
  ).launch()