sifujohn commited on
Commit
6c02936
·
verified ·
1 Parent(s): d85d629

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,8 +7,8 @@ client = InferenceClient(
7
  )
8
 
9
  class GroupTherapyAgent:
10
- def __init__(self, model, tokenizer):
11
- self.model = model
12
  self.tokenizer = tokenizer
13
  self.max_length = 64
14
 
@@ -19,12 +19,12 @@ class GroupTherapyAgent:
19
  return response
20
 
21
  def generate_response(self, input_ids):
22
- output = self.model.generate(input_ids, max_length=self.max_length, num_beams=4)
23
  return output
24
 
25
  class GroupTherapyApplication:
26
- def __init__(self, model, tokenizer):
27
- self.agents = [GroupTherapyAgent(model, tokenizer) for _ in range(4)]
28
 
29
  def get_advice(self, user_question):
30
  advice = []
@@ -33,7 +33,7 @@ class GroupTherapyApplication:
33
  advice.append(response)
34
  return advice
35
 
36
- app = GroupTherapyApplication(model, tokenizer)
37
  advice = app.get_advice("I feel anxious when I have to speak in front of a group of people.")
38
  print(f"Advice from Agents:\n{advice}")
39
 
 
7
  )
8
 
9
  class GroupTherapyAgent:
10
+ def __init__(self, client, tokenizer):
11
+ self.client = client
12
  self.tokenizer = tokenizer
13
  self.max_length = 64
14
 
 
19
  return response
20
 
21
  def generate_response(self, input_ids):
22
+ output = self.client.generate(input_ids, max_length=self.max_length, num_beams=4)
23
  return output
24
 
25
  class GroupTherapyApplication:
26
+ def __init__(self, client, tokenizer):
27
+ self.agents = [GroupTherapyAgent(client, tokenizer) for _ in range(4)]
28
 
29
  def get_advice(self, user_question):
30
  advice = []
 
33
  advice.append(response)
34
  return advice
35
 
36
+ app = GroupTherapyApplication(client, tokenizer)
37
  advice = app.get_advice("I feel anxious when I have to speak in front of a group of people.")
38
  print(f"Advice from Agents:\n{advice}")
39