Upload app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ from transformers import pipeline
|
|
| 9 |
|
| 10 |
# NOTE - we configure docs_url to serve the interactive Docs at the root path
|
| 11 |
# of the app. This way, we can use the docs as a landing page for the app on Spaces.
|
| 12 |
-
|
| 13 |
|
| 14 |
from fastapi import FastAPI
|
| 15 |
from pydantic import BaseModel
|
|
@@ -18,9 +18,14 @@ from transformers import pipeline
|
|
| 18 |
# You can check any other model in the Hugging Face Hub
|
| 19 |
pipe = pipeline(model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# We define that we expect our input to be a string
|
| 25 |
class RequestModel(BaseModel):
|
| 26 |
input: str
|
|
|
|
| 9 |
|
| 10 |
# NOTE - we configure docs_url to serve the interactive Docs at the root path
|
| 11 |
# of the app. This way, we can use the docs as a landing page for the app on Spaces.
|
| 12 |
+
|
| 13 |
|
| 14 |
from fastapi import FastAPI
|
| 15 |
from pydantic import BaseModel
|
|
|
|
| 18 |
# You can check any other model in the Hugging Face Hub
|
| 19 |
pipe = pipeline(model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
|
| 20 |
|
| 21 |
+
app = FastAPI(docs_url="/")
|
| 22 |
+
|
| 23 |
|
| 24 |
+
@app.get("/")
|
| 25 |
+
def greet_json():
|
| 26 |
+
return {"working..."}
|
| 27 |
+
|
| 28 |
+
|
| 29 |
# We define that we expect our input to be a string
|
| 30 |
class RequestModel(BaseModel):
|
| 31 |
input: str
|