Upload app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ US Army Medical Research Papers Q&A
|
|
| 5 |
|
| 6 |
import os
|
| 7 |
import logging
|
| 8 |
-
from typing import List, Dict, Optional
|
| 9 |
from contextlib import asynccontextmanager
|
| 10 |
|
| 11 |
from fastapi import FastAPI, HTTPException
|
|
@@ -79,13 +79,13 @@ class ImageSource(BaseModel):
|
|
| 79 |
path: Optional[str]
|
| 80 |
filename: Optional[str]
|
| 81 |
score: Optional[float]
|
| 82 |
-
page: Optional[str] # could be int or str depending on metadata
|
| 83 |
file: Optional[str]
|
| 84 |
|
| 85 |
class TextSource(BaseModel):
|
| 86 |
text: str
|
| 87 |
score: float
|
| 88 |
-
page: Optional[str]
|
| 89 |
file: Optional[str]
|
| 90 |
|
| 91 |
class QueryResponse(BaseModel):
|
|
|
|
| 5 |
|
| 6 |
import os
|
| 7 |
import logging
|
| 8 |
+
from typing import List, Dict, Optional, Union
|
| 9 |
from contextlib import asynccontextmanager
|
| 10 |
|
| 11 |
from fastapi import FastAPI, HTTPException
|
|
|
|
| 79 |
path: Optional[str]
|
| 80 |
filename: Optional[str]
|
| 81 |
score: Optional[float]
|
| 82 |
+
page: Optional[Union[str, int]] # could be int or str depending on metadata
|
| 83 |
file: Optional[str]
|
| 84 |
|
| 85 |
class TextSource(BaseModel):
|
| 86 |
text: str
|
| 87 |
score: float
|
| 88 |
+
page: Optional[Union[str, int]]
|
| 89 |
file: Optional[str]
|
| 90 |
|
| 91 |
class QueryResponse(BaseModel):
|