Spaces:
Sleeping
Sleeping
ShahadFawaz99
commited on
Commit
•
5a7d26a
1
Parent(s):
cbc9feb
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def convert_to_fahrenheit(celsius):
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
8 |
demo = gr.Interface(fn=convert_to_fahrenheit, inputs="text", outputs="text")
|
9 |
|
10 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def convert_to_fahrenheit(celsius):
|
4 |
+
try:
|
5 |
+
celsius = float(celsius)
|
6 |
+
fahrenheit = celsius * 9/5 + 32
|
7 |
+
return f"{fahrenheit} °F"
|
8 |
+
except ValueError:
|
9 |
+
return "Please enter a valid number."
|
10 |
+
|
11 |
demo = gr.Interface(fn=convert_to_fahrenheit, inputs="text", outputs="text")
|
12 |
|
13 |
demo.launch()
|