Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from datasets import load_dataset
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
@app.get("/")
|
| 7 |
+
def greet_json():
|
| 8 |
+
# Example: Loading a dataset as part of the API
|
| 9 |
+
dataset = load_dataset("squad")
|
| 10 |
+
return {"Hello": "World!", "dataset_length": len(dataset["train"])}
|