Spaces:
Build error
Build error
Commit ·
c9c3efd
1
Parent(s): a6da76a
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
fn=generate_text,
|
| 14 |
-
inputs=gr.inputs.Textbox(lines=5, placeholder="Input Text..."),
|
| 15 |
-
outputs=gr.outputs.Textbox(label="Generated Text", lines=5),
|
| 16 |
-
title="Text Generator",
|
| 17 |
-
theme="compact"
|
| 18 |
)
|
| 19 |
-
|
| 20 |
-
# Adding an additional input for clearing text
|
| 21 |
-
iface.add_input("textbox", label="Clear", type="text", lines=1, placeholder="Clear text")
|
| 22 |
-
|
| 23 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def greet(name, is_morning, temperature):
|
| 4 |
+
salutation = "Good morning" if is_morning else "Good evening"
|
| 5 |
+
greeting = f"{salutation} {name}. It is {temperature} degrees today"
|
| 6 |
+
celsius = (temperature - 32) * 5 / 9
|
| 7 |
+
return greeting, round(celsius, 2)
|
| 8 |
+
|
| 9 |
+
demo = gr.Interface(
|
| 10 |
+
fn=greet,
|
| 11 |
+
inputs=["text", "number"],
|
| 12 |
+
outputs=["text", "number"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
)
|
| 14 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|