hellodav commited on
Commit
9f4520a
·
verified ·
1 Parent(s): ce617e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -5,8 +5,8 @@ from PIL import Image
5
  import pandas as pd
6
  import pytesseract
7
 
8
- # Install missing dependencies
9
- os.system("pip install transformers pandas pillow pytesseract")
10
 
11
  # Load models
12
  text_model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
@@ -38,10 +38,10 @@ def handle_files(file):
38
  else:
39
  image = Image.open(file)
40
  text = process_image(image)
41
-
42
  # Generate audio from the text
43
  audio = tts_pipeline(text)
44
-
45
  return text, audio["audio"]
46
 
47
  # Gradio interface
 
5
  import pandas as pd
6
  import pytesseract
7
 
8
+ # Install missing dependencies, including PyTorch
9
+ os.system("pip install torch transformers pandas pillow pytesseract")
10
 
11
  # Load models
12
  text_model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
 
38
  else:
39
  image = Image.open(file)
40
  text = process_image(image)
41
+
42
  # Generate audio from the text
43
  audio = tts_pipeline(text)
44
+
45
  return text, audio["audio"]
46
 
47
  # Gradio interface