Vasanth M
commited on
Commit
·
9b601cc
1
Parent(s):
a0ae12b
Add docstr
Browse files
app.py
CHANGED
@@ -1,6 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def convert_temperature(temp, unit):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
try:
|
5 |
temp = float(temp)
|
6 |
if unit == "Celsius":
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def convert_temperature(temp, unit):
|
4 |
+
"""
|
5 |
+
Convert a temperature value between Celsius, Fahrenheit, and Kelvin.
|
6 |
+
|
7 |
+
Args:
|
8 |
+
temp (str or float): The temperature value to convert.
|
9 |
+
unit (str): The unit of the input temperature ('Celsius', 'Fahrenheit', or 'Kelvin').
|
10 |
+
|
11 |
+
Returns:
|
12 |
+
tuple: A tuple containing three strings with the temperature in Celsius, Fahrenheit, and Kelvin,
|
13 |
+
formatted to two decimal places. If input is invalid, returns an error message.
|
14 |
+
"""
|
15 |
try:
|
16 |
temp = float(temp)
|
17 |
if unit == "Celsius":
|