DGameHF commited on
Commit
6182354
·
verified ·
1 Parent(s): dae8775

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -1,22 +1,20 @@
1
  import gradio as gr
2
- from transformers import AutoModelForCausalLM, AutoTokenizer
3
 
4
- model_name = "TheBloke/MythoMax-L2-13B-GGUF"
5
- tokenizer = AutoTokenizer.from_pretrained(model_name)
6
- model = AutoModelForCausalLM.from_pretrained(model_name)
7
 
8
  def chat(input_text):
9
- inputs = tokenizer(input_text, return_tensors="pt")
10
- output = model.generate(**inputs, max_new_tokens=100)
11
- response = tokenizer.decode(output[0], skip_special_tokens=True)
12
- return response
13
 
14
  iface = gr.Interface(
15
  fn=chat,
16
  inputs="text",
17
  outputs="text",
18
  title="Dika AI - MythoMax Lite",
19
- description="Chatbot AI berbasis MythoMax 13B GGUF, optimized for Hugging Face free tier!"
20
  )
21
 
22
  iface.launch()
 
1
  import gradio as gr
2
+ from llama_cpp import Llama
3
 
4
+ # Load model (gunakan versi GGUF yang ringan)
5
+ model_path = "TheBloke/MythoMax-L2-13B-GGUF/mythomax.gguf"
6
+ llm = Llama(model_path=model_path, n_ctx=2048)
7
 
8
  def chat(input_text):
9
+ output = llm(input_text, max_tokens=100)
10
+ return output["choices"][0]["text"]
 
 
11
 
12
  iface = gr.Interface(
13
  fn=chat,
14
  inputs="text",
15
  outputs="text",
16
  title="Dika AI - MythoMax Lite",
17
+ description="Chatbot AI berbasis MythoMax 13B GGUF, optimized for Hugging Face CPU!"
18
  )
19
 
20
  iface.launch()