rockerritesh commited on
Commit
bc0c9d8
·
verified ·
1 Parent(s): 95f4d99

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -3
main.py CHANGED
@@ -64,7 +64,6 @@
64
  # import uvicorn
65
  # uvicorn.run(app, host="0.0.0.0", port=7860)
66
 
67
-
68
  from fastapi import FastAPI, File, UploadFile, BackgroundTasks
69
  from transformers import PaliGemmaProcessor, PaliGemmaForConditionalGeneration
70
  import torch
@@ -146,7 +145,7 @@ def predict(image):
146
  return decoded
147
 
148
  @app.post("/extract_text")
149
- async def extract_text(file: UploadFile = File(...), background_tasks: BackgroundTasks):
150
  """Extract text from a single image"""
151
  try:
152
  start_time = time.time()
@@ -163,7 +162,7 @@ async def extract_text(file: UploadFile = File(...), background_tasks: Backgroun
163
  return {"error": str(e)}
164
 
165
  @app.post("/batch_extract_text")
166
- async def batch_extract_text(files: List[UploadFile] = File(...), background_tasks: BackgroundTasks):
167
  """Extract text from multiple images with batching"""
168
  try:
169
  start_time = time.time()
 
64
  # import uvicorn
65
  # uvicorn.run(app, host="0.0.0.0", port=7860)
66
 
 
67
  from fastapi import FastAPI, File, UploadFile, BackgroundTasks
68
  from transformers import PaliGemmaProcessor, PaliGemmaForConditionalGeneration
69
  import torch
 
145
  return decoded
146
 
147
  @app.post("/extract_text")
148
+ async def extract_text(background_tasks: BackgroundTasks, file: UploadFile = File(...)):
149
  """Extract text from a single image"""
150
  try:
151
  start_time = time.time()
 
162
  return {"error": str(e)}
163
 
164
  @app.post("/batch_extract_text")
165
+ async def batch_extract_text(background_tasks: BackgroundTasks, files: List[UploadFile] = File(...)):
166
  """Extract text from multiple images with batching"""
167
  try:
168
  start_time = time.time()