archit11 commited on
Commit
4269171
·
verified ·
1 Parent(s): c621812

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -10,18 +10,13 @@ MODEL_NAME = 'sarvamai/shuka_v1'
10
  SAMPLE_RATE = 16000
11
  MAX_NEW_TOKENS = 256
12
 
13
- # Load the ShukaPipeline
14
- def load_pipeline():
15
- model = transformers.AutoModel.from_pretrained(MODEL_NAME, trust_remote_code=True)
16
- pipeline = transformers.pipeline(
17
- "shuka-pipeline",
18
- model=model,
19
- torch_dtype=torch.float16,
20
- device=0 if torch.cuda.is_available() else -1,
21
- )
22
- return pipeline
23
-
24
- pipe = load_pipeline()
25
 
26
  def create_conversation_turns(prompt: str) -> List[Dict[str, str]]:
27
  return [
@@ -45,7 +40,7 @@ def transcribe_and_respond(audio: np.ndarray) -> str:
45
  }
46
 
47
  # Generate response
48
- response = pipe(inputs, max_new_tokens=MAX_NEW_TOKENS, temperature=0.7, repetition_penalty=1.1)
49
 
50
  return response
51
  except Exception as e:
 
10
  SAMPLE_RATE = 16000
11
  MAX_NEW_TOKENS = 256
12
 
13
+ # Load the pipeline
14
+ pipe = transformers.pipeline(
15
+ model=MODEL_NAME,
16
+ trust_remote_code=True,
17
+ device=0,
18
+ torch_dtype='bfloat16'
19
+ )
 
 
 
 
 
20
 
21
  def create_conversation_turns(prompt: str) -> List[Dict[str, str]]:
22
  return [
 
40
  }
41
 
42
  # Generate response
43
+ response = pipe(inputs, max_new_tokens=MAX_NEW_TOKENS)
44
 
45
  return response
46
  except Exception as e: