Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,8 @@ client = InferenceClient(
|
|
| 7 |
)
|
| 8 |
|
| 9 |
class GroupTherapyAgent:
|
| 10 |
-
|
| 11 |
-
self.
|
| 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.
|
| 23 |
return output
|
| 24 |
|
| 25 |
class GroupTherapyApplication:
|
| 26 |
-
def __init__(self,
|
| 27 |
-
self.agents = [GroupTherapyAgent(
|
| 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(
|
| 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 |
|