Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import google.genai as genai
|
|
| 3 |
from google.genai import types
|
| 4 |
from PIL import Image
|
| 5 |
import os
|
| 6 |
-
import textract
|
| 7 |
|
| 8 |
# List of available models (including experimental and recent ones)
|
| 9 |
models = [
|
|
@@ -41,12 +40,7 @@ def process_files(files, model_type):
|
|
| 41 |
if model_type == "multimodal" and file_path.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp')):
|
| 42 |
img = Image.open(file_path)
|
| 43 |
inputs.append(img)
|
| 44 |
-
|
| 45 |
-
try:
|
| 46 |
-
text = textract.process(file_path).decode('utf-8')
|
| 47 |
-
inputs.append(text)
|
| 48 |
-
except Exception as e:
|
| 49 |
-
inputs.append(f"Error extracting text from {os.path.basename(file_path)}: {str(e)}")
|
| 50 |
return inputs
|
| 51 |
|
| 52 |
# Chat submit function
|
|
|
|
| 3 |
from google.genai import types
|
| 4 |
from PIL import Image
|
| 5 |
import os
|
|
|
|
| 6 |
|
| 7 |
# List of available models (including experimental and recent ones)
|
| 8 |
models = [
|
|
|
|
| 40 |
if model_type == "multimodal" and file_path.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.bmp')):
|
| 41 |
img = Image.open(file_path)
|
| 42 |
inputs.append(img)
|
| 43 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
return inputs
|
| 45 |
|
| 46 |
# Chat submit function
|