Spaces:
Sleeping
Sleeping
model change
Browse files
app.py
CHANGED
|
@@ -47,14 +47,18 @@ final_answer = FinalAnswerTool()
|
|
| 47 |
#model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud' ,# it is possible that this model may be overloaded
|
| 48 |
#custom_role_conversions=None,
|
| 49 |
#)
|
|
|
|
| 50 |
class DummyModel:
|
| 51 |
def __init__(self):
|
| 52 |
self.last_input_token_count = 0
|
| 53 |
self.last_output_token_count = 0
|
| 54 |
|
| 55 |
-
def __call__(self, prompt
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
return {
|
| 60 |
"text": """Thought: I now know the final answer.
|
|
|
|
| 47 |
#model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud' ,# it is possible that this model may be overloaded
|
| 48 |
#custom_role_conversions=None,
|
| 49 |
#)
|
| 50 |
+
|
| 51 |
class DummyModel:
|
| 52 |
def __init__(self):
|
| 53 |
self.last_input_token_count = 0
|
| 54 |
self.last_output_token_count = 0
|
| 55 |
|
| 56 |
+
def __call__(self, prompt, **kwargs):
|
| 57 |
+
# prompt est une liste de messages [{"role": ..., "content": ...}, ...]
|
| 58 |
+
text_prompt = "\n".join([msg["content"] for msg in prompt if "content" in msg])
|
| 59 |
+
|
| 60 |
+
self.last_input_token_count = len(text_prompt.split())
|
| 61 |
+
self.last_output_token_count = 10 # valeur arbitraire
|
| 62 |
|
| 63 |
return {
|
| 64 |
"text": """Thought: I now know the final answer.
|