KevanSoon commited on
Commit
f617fb3
·
1 Parent(s): 6e28bd0

adjjusted pytesseract workflow gemini model

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -24,6 +24,7 @@ from gradio_client import Client, handle_file
24
  from PIL import Image
25
 
26
 
 
27
  from auth.clerk import verify_clerk_jwt
28
  from tools.tools import (
29
  extract_text_from_html,
@@ -994,7 +995,7 @@ async def generate_html_from_tesseract_data(translated_data: list[dict]) -> str:
994
  raise ValueError("GEMINI_API_KEY not found in environment variables.")
995
 
996
  genai.configure(api_key=api_key)
997
- model = genai.GenerativeModel(model_name="gemini-1.5-flash") # Updated model name
998
 
999
  json_data_for_prompt = json.dumps(translated_data, indent=2, ensure_ascii=False)
1000
 
@@ -1029,8 +1030,6 @@ async def generate_html_from_tesseract_data(translated_data: list[dict]) -> str:
1029
  return f"<html><body><h1>HTML Generation Error</h1><p>{html.escape(error_message)}</p></body></html>"
1030
 
1031
 
1032
- app = FastAPI()
1033
-
1034
  @app.post("/api/translate_file_pytesseract", response_class=HTMLResponse)
1035
  async def translate_document_mvp(
1036
  target_language: str = Form(...), file: UploadFile = File(...)
 
24
  from PIL import Image
25
 
26
 
27
+
28
  from auth.clerk import verify_clerk_jwt
29
  from tools.tools import (
30
  extract_text_from_html,
 
995
  raise ValueError("GEMINI_API_KEY not found in environment variables.")
996
 
997
  genai.configure(api_key=api_key)
998
+ model = genai.GenerativeModel(model_name="gemini-2.5-flash") # Updated model name
999
 
1000
  json_data_for_prompt = json.dumps(translated_data, indent=2, ensure_ascii=False)
1001
 
 
1030
  return f"<html><body><h1>HTML Generation Error</h1><p>{html.escape(error_message)}</p></body></html>"
1031
 
1032
 
 
 
1033
  @app.post("/api/translate_file_pytesseract", response_class=HTMLResponse)
1034
  async def translate_document_mvp(
1035
  target_language: str = Form(...), file: UploadFile = File(...)