GIGAParviz commited on
Commit
8b0d499
·
verified ·
1 Parent(s): 1e61d2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import gradio as gr
3
  from unsloth import FastLanguageModel
4
  import torch
@@ -21,7 +20,7 @@ def predict(input_text):
21
  tokenize=True,
22
  add_generation_prompt=True,
23
  return_tensors="pt",
24
- ).to("cuda")
25
 
26
  outputs = model.generate(
27
  input_ids=inputs,
@@ -30,7 +29,7 @@ def predict(input_text):
30
  )
31
 
32
  decoded_output = tokenizer.batch_decode(outputs, skip_special_tokens=True)
33
- assistant_response = decoded_output[0].split('assistant')[-1].strip()
34
 
35
  return assistant_response
36
 
@@ -39,7 +38,7 @@ iface = gr.Interface(
39
  inputs="text",
40
  outputs="text",
41
  title="Parviz(eng) Chatbot",
42
- description="A simple chatbot interface using FastLanguageModel.",
43
  )
44
 
45
  iface.launch()
 
 
1
  import gradio as gr
2
  from unsloth import FastLanguageModel
3
  import torch
 
20
  tokenize=True,
21
  add_generation_prompt=True,
22
  return_tensors="pt",
23
+ )
24
 
25
  outputs = model.generate(
26
  input_ids=inputs,
 
29
  )
30
 
31
  decoded_output = tokenizer.batch_decode(outputs, skip_special_tokens=True)
32
+ assistant_response = decoded_output[0].split('assistant\n')[-1].strip()
33
 
34
  return assistant_response
35
 
 
38
  inputs="text",
39
  outputs="text",
40
  title="Parviz(eng) Chatbot",
41
+ description="LLM Test model .",
42
  )
43
 
44
  iface.launch()