alakxender commited on
Commit
c96a8ff
·
1 Parent(s): cbeca2d
Files changed (2) hide show
  1. README.md +2 -2
  2. app.py +1 -47
README.md CHANGED
@@ -4,10 +4,10 @@ emoji: 📝
4
  colorFrom: gray
5
  colorTo: yellow
6
  sdk: gradio
7
- sdk_version: 6.6.0
8
  app_file: app.py
9
  pinned: false
10
  short_description: Thaana text-to-image, ocr
11
  ---
12
-
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
4
  colorFrom: gray
5
  colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 5.25.2
8
  app_file: app.py
9
  pinned: false
10
  short_description: Thaana text-to-image, ocr
11
  ---
12
+
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,8 +1,5 @@
1
  import spaces
2
  import gradio as gr
3
- import os
4
- import sys
5
- import subprocess
6
  import numpy as np
7
  from paligemma2 import PaliGemma2Handler, MODELS as PALIGEMMA_MODELS
8
  from gemma import GemmaHandler, MODELS as GEMMA_MODELS
@@ -378,49 +375,6 @@ with gr.Blocks(title="Dhivehi Image to Text",css=css) as demo:
378
  outputs=[pdf_text_output_gemma, pdf_bbox_output_gemma]
379
  )
380
 
381
- # Function to install requirements
382
- def install_requirements():
383
- requirements_path = 'requirements.txt'
384
-
385
- # Check if requirements.txt exists
386
- if not os.path.exists(requirements_path):
387
- print("Error: requirements.txt not found")
388
- return False
389
-
390
- try:
391
- print("Installing requirements...")
392
- # Using --no-cache-dir to avoid memory issues
393
- subprocess.check_call([
394
- sys.executable,
395
- "-m",
396
- "pip",
397
- "install",
398
- "-r",
399
- requirements_path,
400
- "--no-cache-dir"
401
- ])
402
- print("Successfully installed all requirements")
403
- return True
404
- except subprocess.CalledProcessError as e:
405
- print(f"Error installing requirements: {e}")
406
- return False
407
- except Exception as e:
408
- print(f"Unexpected error: {e}")
409
- return False
410
-
411
  # Launch the app
412
  if __name__ == "__main__":
413
- # First install requirements
414
- success = install_requirements()
415
- if success:
416
- print("All requirements installed successfully")
417
-
418
- # Pre-load the multiline gemma model
419
- #print("Loading default Gemma Multiline model...")
420
- #gemma_multiline_handler.load_model(list(GEMMA_MULTILINE_MODELS.keys())[0])
421
- #print("Default model loaded.")
422
-
423
- demo.launch()
424
- else:
425
- print("Failed to install some requirements")
426
- print("Failed to install some requirements")
 
1
  import spaces
2
  import gradio as gr
 
 
 
3
  import numpy as np
4
  from paligemma2 import PaliGemma2Handler, MODELS as PALIGEMMA_MODELS
5
  from gemma import GemmaHandler, MODELS as GEMMA_MODELS
 
375
  outputs=[pdf_text_output_gemma, pdf_bbox_output_gemma]
376
  )
377
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  # Launch the app
379
  if __name__ == "__main__":
380
+ demo.launch()