Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,3 +10,20 @@ class NumberInput(BaseModel):
|
|
| 10 |
def compute_square(data: NumberInput):
|
| 11 |
result = data.number ** 2
|
| 12 |
return {"input": data.number, "square": result}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def compute_square(data: NumberInput):
|
| 11 |
result = data.number ** 2
|
| 12 |
return {"input": data.number, "square": result}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
from fastapi.responses import HTMLResponse
|
| 16 |
+
|
| 17 |
+
@app.get("/", response_class=HTMLResponse)
|
| 18 |
+
def home():
|
| 19 |
+
return """
|
| 20 |
+
<html>
|
| 21 |
+
<head><title>Square API</title></head>
|
| 22 |
+
<body>
|
| 23 |
+
<h1>Bienvenue sur l'API de calcul de carré !</h1>
|
| 24 |
+
<p>Utilisez l'interface <a href='/docs'>/docs</a> pour tester l'API.</p>
|
| 25 |
+
</body>
|
| 26 |
+
</html>
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
|