Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,16 +15,16 @@ HF_TOKEN = os.getenv("HF_TOKEN")
|
|
| 15 |
|
| 16 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 17 |
@tool
|
| 18 |
-
def
|
| 19 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 20 |
"""A tool that compares the actual weathers degrees and the optimal fermentation degrees of a product in order to flag with an alert!!
|
| 21 |
|
| 22 |
Args:
|
| 23 |
-
|
| 24 |
optimal_fermentation_degrees: A float representing the degrees that should be the fermentation process.
|
| 25 |
"""
|
| 26 |
try:
|
| 27 |
-
dif_degrees =
|
| 28 |
if abs(dif_degrees) >= 1.5:
|
| 29 |
if dif_degrees < 0:
|
| 30 |
return f"RED LIGHT - the difference degrees between optimal and current weather are {str(dif_degrees)}ºC - YOU SHOULD INCREASE THE HEATER BY {str(dif_degrees)}ºC!"
|
|
@@ -33,7 +33,7 @@ def compare_degrees(current_weather:float, optimal_fermentation_degrees:float)->
|
|
| 33 |
else:
|
| 34 |
return f"GREEN LIGHT - the difference degrees between optimal and current weather are {str(dif_degrees)} - DEGREES FOR FERMENTATION IN RANGE!"
|
| 35 |
except Exception as e:
|
| 36 |
-
return f"Error fetching {str(
|
| 37 |
|
| 38 |
|
| 39 |
@tool
|
|
@@ -72,7 +72,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 72 |
|
| 73 |
agent = CodeAgent(
|
| 74 |
model=model,
|
| 75 |
-
tools=[search_info_tool,
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|
|
|
|
| 15 |
|
| 16 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 17 |
@tool
|
| 18 |
+
def alarm_comparator_degrees(current_avarage_weather:float, optimal_fermentation_degrees:float)-> str: #it's import to specify the return type
|
| 19 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 20 |
"""A tool that compares the actual weathers degrees and the optimal fermentation degrees of a product in order to flag with an alert!!
|
| 21 |
|
| 22 |
Args:
|
| 23 |
+
current_avarage_weather: A float representing the avarage degrees of current weather.
|
| 24 |
optimal_fermentation_degrees: A float representing the degrees that should be the fermentation process.
|
| 25 |
"""
|
| 26 |
try:
|
| 27 |
+
dif_degrees = current_avarage_weather - optimal_fermentation_degrees
|
| 28 |
if abs(dif_degrees) >= 1.5:
|
| 29 |
if dif_degrees < 0:
|
| 30 |
return f"RED LIGHT - the difference degrees between optimal and current weather are {str(dif_degrees)}ºC - YOU SHOULD INCREASE THE HEATER BY {str(dif_degrees)}ºC!"
|
|
|
|
| 33 |
else:
|
| 34 |
return f"GREEN LIGHT - the difference degrees between optimal and current weather are {str(dif_degrees)} - DEGREES FOR FERMENTATION IN RANGE!"
|
| 35 |
except Exception as e:
|
| 36 |
+
return f"Error fetching {str(current_avarage_weather)} and {str(optimal_fermentation_degrees)}."
|
| 37 |
|
| 38 |
|
| 39 |
@tool
|
|
|
|
| 72 |
|
| 73 |
agent = CodeAgent(
|
| 74 |
model=model,
|
| 75 |
+
tools=[search_info_tool, alarm_comparator_degrees, image_generation_tool, final_answer], ## add your tools here (don't remove final answer)
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|