Spaces:
Build error
Build error
Upload tools/addition.py with huggingface_hub
Browse files- tools/addition.py +27 -0
tools/addition.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
# --- User Defined Logic ---
|
| 7 |
+
def addition(a: float, b: float) -> float:
|
| 8 |
+
"""Addition de deux nombres.
|
| 9 |
+
|
| 10 |
+
Args:
|
| 11 |
+
a: Premier nombre à additionner.
|
| 12 |
+
b: Deuxième nombre à additionner.
|
| 13 |
+
|
| 14 |
+
Returns:
|
| 15 |
+
La somme des deux nombres fournis.
|
| 16 |
+
"""
|
| 17 |
+
return a + b
|
| 18 |
+
|
| 19 |
+
# --- Interface Factory ---
|
| 20 |
+
def create_interface():
|
| 21 |
+
return gr.Interface(
|
| 22 |
+
fn=addition,
|
| 23 |
+
inputs=[gr.Textbox(label=k) for k in ['a', 'b']],
|
| 24 |
+
outputs=gr.Textbox(label="Résultat de l'addition"),
|
| 25 |
+
title="addition",
|
| 26 |
+
description="Auto-generated tool: addition"
|
| 27 |
+
)
|