Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,12 +35,12 @@ class GetCurrentTimeInTimezoneTool(Tool):
|
|
| 35 |
# Load the pre-built tool for image generation from the Hugging Face Hub
|
| 36 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 37 |
|
| 38 |
-
# Model setup for the agent (
|
| 39 |
final_answer = FinalAnswerTool()
|
| 40 |
model = HfApiModel(
|
| 41 |
-
max_tokens=
|
| 42 |
-
temperature=0.
|
| 43 |
-
model_id='
|
| 44 |
custom_role_conversions=None,
|
| 45 |
)
|
| 46 |
|
|
@@ -53,7 +53,7 @@ def get_model_response_with_retry(model_input, max_retries=3):
|
|
| 53 |
retries = 0
|
| 54 |
while retries < max_retries:
|
| 55 |
try:
|
| 56 |
-
client = InferenceClient("
|
| 57 |
response = client.text_generation(model_input)
|
| 58 |
return response
|
| 59 |
except Exception as e:
|
|
|
|
| 35 |
# Load the pre-built tool for image generation from the Hugging Face Hub
|
| 36 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 37 |
|
| 38 |
+
# Model setup for the agent (switching to GPT-2 for better reliability)
|
| 39 |
final_answer = FinalAnswerTool()
|
| 40 |
model = HfApiModel(
|
| 41 |
+
max_tokens=1024, # Adjusting token limit for GPT-2
|
| 42 |
+
temperature=0.7,
|
| 43 |
+
model_id='gpt2', # Switching to GPT-2
|
| 44 |
custom_role_conversions=None,
|
| 45 |
)
|
| 46 |
|
|
|
|
| 53 |
retries = 0
|
| 54 |
while retries < max_retries:
|
| 55 |
try:
|
| 56 |
+
client = InferenceClient("gpt2") # Using GPT-2 model
|
| 57 |
response = client.text_generation(model_input)
|
| 58 |
return response
|
| 59 |
except Exception as e:
|