Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,6 +87,17 @@ class ImageScraper:
|
|
| 87 |
print(f"Keyword extraction error: {e}")
|
| 88 |
return self.get_fallback_keywords()
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
def extract_noun_phrases(self, text: str) -> List[str]:
|
| 91 |
"""Extract important noun phrases from text"""
|
| 92 |
words = text.lower().split()
|
|
|
|
| 87 |
print(f"Keyword extraction error: {e}")
|
| 88 |
return self.get_fallback_keywords()
|
| 89 |
|
| 90 |
+
|
| 91 |
+
def process_images(images):
|
| 92 |
+
processed_images = []
|
| 93 |
+
for img in images:
|
| 94 |
+
# Load and resize image
|
| 95 |
+
image = Image.open(requests.get(img['url'], stream=True).raw)
|
| 96 |
+
image = image.resize((640, 480)) # Resize to reduce memory usage
|
| 97 |
+
processed_images.append(image)
|
| 98 |
+
return processed_images
|
| 99 |
+
|
| 100 |
+
|
| 101 |
def extract_noun_phrases(self, text: str) -> List[str]:
|
| 102 |
"""Extract important noun phrases from text"""
|
| 103 |
words = text.lower().split()
|