Spaces:
Sleeping
Sleeping
testing
Browse files
app.py
CHANGED
|
@@ -26,7 +26,9 @@ Check out the docs for the `/predict` endpoint below to try it out!
|
|
| 26 |
|
| 27 |
# NOTE - we configure docs_url to serve the interactive Docs at the root path
|
| 28 |
# of the app. This way, we can use the docs as a landing page for the app on Spaces.
|
| 29 |
-
app = FastAPI(
|
|
|
|
|
|
|
| 30 |
|
| 31 |
pipe = pipeline("document-question-answering", model="impira/layoutlm-document-qa")
|
| 32 |
|
|
@@ -45,6 +47,29 @@ pipe = pipeline("document-question-answering", model="impira/layoutlm-document-q
|
|
| 45 |
# output = pipe(image, question)
|
| 46 |
# return output
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
@app.get("/hello")
|
| 50 |
def read_root():
|
|
|
|
| 26 |
|
| 27 |
# NOTE - we configure docs_url to serve the interactive Docs at the root path
|
| 28 |
# of the app. This way, we can use the docs as a landing page for the app on Spaces.
|
| 29 |
+
app = FastAPI(
|
| 30 |
+
title="ChimichangApp",
|
| 31 |
+
docs_url="/", description=description)
|
| 32 |
|
| 33 |
pipe = pipeline("document-question-answering", model="impira/layoutlm-document-qa")
|
| 34 |
|
|
|
|
| 47 |
# output = pipe(image, question)
|
| 48 |
# return output
|
| 49 |
|
| 50 |
+
@app.get("/hello_2")
|
| 51 |
+
def read_root():
|
| 52 |
+
image = 'https://templates.invoicehome.com/invoice-template-us-neat-750px.png'
|
| 53 |
+
|
| 54 |
+
question = "What is the invoice number?"
|
| 55 |
+
output = pipe(image, question)
|
| 56 |
+
return output
|
| 57 |
+
|
| 58 |
+
@app.get("/hello_3")
|
| 59 |
+
def read_root():
|
| 60 |
+
image = 'https://templates.invoicehome.com/invoice-template-us-neat-750px.png'
|
| 61 |
+
|
| 62 |
+
question = "What is the invoice number?"
|
| 63 |
+
output = pipe(image, question)
|
| 64 |
+
return output
|
| 65 |
+
|
| 66 |
+
@app.get("/hello_4")
|
| 67 |
+
def read_root():
|
| 68 |
+
image = 'https://templates.invoicehome.com/invoice-template-us-neat-750px.png'
|
| 69 |
+
|
| 70 |
+
question = "What is the invoice number?"
|
| 71 |
+
output = pipe(image, question)
|
| 72 |
+
return output
|
| 73 |
|
| 74 |
@app.get("/hello")
|
| 75 |
def read_root():
|