Svngoku commited on
Commit
94f6203
·
verified ·
1 Parent(s): 65a269a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -3,7 +3,7 @@ import base64
3
  import gradio as gr
4
  from mistralai import Mistral, ImageURLChunk
5
  from mistralai.models import OCRResponse
6
- from typing import Union, List, Tuple
7
  import requests
8
  import shutil
9
  import time
@@ -203,7 +203,7 @@ class OCRProcessor:
203
  except Exception as e:
204
  return self._handle_error("PDF URL processing", e), []
205
 
206
- def ocr_uploaded_image(self, image_file: Union[str, bytes]) -> Tuple[str, gr.components.Image.update]:
207
  file_name = getattr(image_file, 'name', f"image_{int(time.time())}.jpg")
208
  logger.info(f"Processing uploaded image: {file_name}")
209
  try:
@@ -261,7 +261,7 @@ class OCRProcessor:
261
 
262
  @staticmethod
263
  def _handle_error(context: str, error: Exception) -> str:
264
- logger.error(f"Error in {context}: {str(error)}")
265
  return f"**Error in {context}:** {str(error)}"
266
 
267
  def create_interface():
 
3
  import gradio as gr
4
  from mistralai import Mistral, ImageURLChunk
5
  from mistralai.models import OCRResponse
6
+ from typing import Union, List, Tuple, Any
7
  import requests
8
  import shutil
9
  import time
 
203
  except Exception as e:
204
  return self._handle_error("PDF URL processing", e), []
205
 
206
+ def ocr_uploaded_image(self, image_file: Union[str, bytes]) -> Tuple[str, Any]:
207
  file_name = getattr(image_file, 'name', f"image_{int(time.time())}.jpg")
208
  logger.info(f"Processing uploaded image: {file_name}")
209
  try:
 
261
 
262
  @staticmethod
263
  def _handle_error(context: str, error: Exception) -> str:
264
+ logger.error(f"Error in {context}: {str(e)}")
265
  return f"**Error in {context}:** {str(error)}"
266
 
267
  def create_interface():