KGSAGAR commited on
Commit
5534d9e
·
verified ·
1 Parent(s): 3d34c7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -1,10 +1,24 @@
1
  import gradio as gr
 
 
2
  from huggingface_hub import InferenceClient
3
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
- client = InferenceClient("KGSAGAR/Sarvam-1-text-normalization-3r")
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
 
10
  def respond(
 
1
  import gradio as gr
2
+ from transformers import AutoTokenizer, AutoModelForCausalLM
3
+ from peft import PeftModel
4
  from huggingface_hub import InferenceClient
5
 
6
  """
7
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
8
  """
9
+
10
+ # Load the tokenizer
11
+ tokenizer = AutoTokenizer.from_pretrained("sarvamai/sarvam-1")
12
+
13
+ # Load the base model
14
+ base_model = AutoModelForCausalLM.from_pretrained("sarvamai/sarvam-1")
15
+
16
+ # Load the PEFT adapter
17
+ peft_model = PeftModel.from_pretrained(base_model, "KGSAGAR/Sarvam-1-text-normalization-3r")
18
+ peft_model = peft_model.merge_and_unload()
19
+
20
+
21
+ client = InferenceClient(peft_model)
22
 
23
 
24
  def respond(