Spaces:
Runtime error
Runtime error
Commit
·
b3728fd
1
Parent(s):
e28bd28
Demo pour la POE
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def salut_elabore(nom, cestLeMatin, temperature):
|
| 4 |
+
#salutation = "Bonjour" if cestLeMatin else "Bonsoir"
|
| 5 |
+
|
| 6 |
+
if cestLeMatin:
|
| 7 |
+
salutation = "Bonjour"
|
| 8 |
+
else:
|
| 9 |
+
salutation = "Bonsoir"
|
| 10 |
+
|
| 11 |
+
emotion = "C'est froid!" if temperature<15 else "Il fait bon"
|
| 12 |
+
|
| 13 |
+
phrase = f"{salutation} {nom}!\n {emotion} avec {temperature} degrés!"
|
| 14 |
+
|
| 15 |
+
return phrase, temperature
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(
|
| 18 |
+
fn=salut_elabore,
|
| 19 |
+
inputs=[
|
| 20 |
+
gr.Textbox(lines=2, placeholder="Rentrez votre nom ici ..." ),
|
| 21 |
+
gr.Checkbox(label="Est-ce le matin?"),
|
| 22 |
+
gr.Slider(0,40)
|
| 23 |
+
],
|
| 24 |
+
outputs=["text", "number"],
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
demo.launch(share=True, debug=True)
|