Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions text_extract_api/extract/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def ocr_task(
filename: str,
file_hash: str,
ocr_cache: bool,
prompt: str,
model: str,
language: str,
storage_profile: str,
prompt: Optional[str] = None,
model: Optional[str] = None,
language: Optional[str] = None,
storage_profile: Optional[str] = None,
storage_filename: Optional[str] = None,
):
"""
Expand Down Expand Up @@ -85,7 +85,7 @@ def ocr_task(

if storage_profile:
if not storage_filename:
storage_filename = filename.replace('.pdf', '.md')
storage_filename = filename.replace('.', '_') + '.pdf'

storage_manager = StorageManager(storage_profile)
storage_manager.save(filename, storage_filename, extracted_text)
Expand Down
6 changes: 3 additions & 3 deletions text_extract_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def ocr_endpoint(
async def ocr_upload_endpoint(
strategy: str = Form(...),
prompt: str = Form(None),
model: str = Form(...),
model: str = Form(None),
file: UploadFile = File(...),
ocr_cache: bool = Form(...),
storage_profile: str = Form('default'),
Expand All @@ -104,7 +104,7 @@ class OllamaPullRequest(BaseModel):
class OcrRequest(BaseModel):
strategy: str = Field(..., description="OCR strategy to use")
prompt: Optional[str] = Field(None, description="Prompt for the Ollama model")
model: str = Field(..., description="Model to use for the Ollama endpoint")
model: Optional[str] = Field(None, description="Model to use for the Ollama endpoint")
file: FileField = Field(..., description="Base64 encoded document file")
ocr_cache: bool = Field(..., description="Enable OCR result caching")
storage_profile: Optional[str] = Field('default', description="Storage profile to use")
Expand All @@ -126,7 +126,7 @@ def validate_storage_profile(cls, v):
class OcrFormRequest(BaseModel):
strategy: str = Field(..., description="OCR strategy to use")
prompt: Optional[str] = Field(None, description="Prompt for the Ollama model")
model: str = Field(..., description="Model to use for the Ollama endpoint")
model: Optional[str] = Field(None, description="Model to use for the Ollama endpoint")
ocr_cache: bool = Field(..., description="Enable OCR result caching")
storage_profile: Optional[str] = Field('default', description="Storage profile to use")
storage_filename: Optional[str] = Field(None, description="Storage filename to use")
Expand Down