Spaces:
Sleeping
Sleeping
peterbonnesoeur
commited on
Commit
·
7a4f0f5
1
Parent(s):
9e5b98a
Quick fix
Browse files
app.py
CHANGED
@@ -2,6 +2,6 @@ from smolagents import launch_gradio_demo
|
|
2 |
from typing import Optional
|
3 |
from tool import UnitConversionTool
|
4 |
|
5 |
-
tool =
|
6 |
|
7 |
launch_gradio_demo(tool)
|
|
|
2 |
from typing import Optional
|
3 |
from tool import UnitConversionTool
|
4 |
|
5 |
+
tool = UnitConversionTool()
|
6 |
|
7 |
launch_gradio_demo(tool)
|
tool.py
CHANGED
@@ -21,8 +21,8 @@ class UnitConversionTool(Tool):
|
|
21 |
}
|
22 |
conversion = conversions.get((from_unit, to_unit))
|
23 |
if callable(conversion):
|
24 |
-
return conversion(value)
|
25 |
elif conversion:
|
26 |
-
return value * conversion
|
27 |
else:
|
28 |
return "Conversion not supported."
|
|
|
21 |
}
|
22 |
conversion = conversions.get((from_unit, to_unit))
|
23 |
if callable(conversion):
|
24 |
+
return conversion(float(value))
|
25 |
elif conversion:
|
26 |
+
return float(value) * conversion
|
27 |
else:
|
28 |
return "Conversion not supported."
|