Update app.py
Browse files
app.py
CHANGED
|
@@ -49,21 +49,20 @@ def process_image(img):
|
|
| 49 |
wiki_url = search_terms_wikipedia.get(predicted_class, "No Wikipedia entry found.")
|
| 50 |
|
| 51 |
# Generate FLUX image
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
return classification_results, generated_image, wiki_url
|
| 68 |
|
| 69 |
# Load the learner
|
|
|
|
| 49 |
wiki_url = search_terms_wikipedia.get(predicted_class, "No Wikipedia entry found.")
|
| 50 |
|
| 51 |
# Generate FLUX image
|
| 52 |
+
result = fal_client.subscribe(
|
| 53 |
+
"fal-ai/flux/schnell",
|
| 54 |
+
arguments={
|
| 55 |
+
"prompt": f"A detailed, artistic interpretation of {predicted_class} flower in natural setting",
|
| 56 |
+
"image_size": "256x256" # Low res for testing
|
| 57 |
+
},
|
| 58 |
+
with_logs=True,
|
| 59 |
+
on_queue_update=on_queue_update,
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
# Convert the image data
|
| 63 |
+
image_data = base64.b64decode(result['image'])
|
| 64 |
+
generated_image = Image.open(io.BytesIO(image_data))
|
| 65 |
+
|
|
|
|
| 66 |
return classification_results, generated_image, wiki_url
|
| 67 |
|
| 68 |
# Load the learner
|