Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import gradio as gr
|
|
2 |
import fal_client
|
3 |
import os
|
4 |
from huggingface_hub import HfApi, whoami
|
5 |
-
from gradio.processing_utils import file_to_temp_file
|
6 |
|
7 |
try:
|
8 |
FAL_KEY = os.getenv("FAL_KEY")
|
@@ -26,7 +25,6 @@ def generate_image(prompt, image=None):
|
|
26 |
|
27 |
if image:
|
28 |
# Image-to-Image
|
29 |
-
temp_file_path = file_to_temp_file(image, dir=".")
|
30 |
result = fal_client.run(
|
31 |
"fal-ai/nano-banana/edit",
|
32 |
arguments={
|
@@ -56,12 +54,11 @@ def multi_image_edit(prompt, images):
|
|
56 |
|
57 |
output_images = []
|
58 |
for image in images:
|
59 |
-
temp_file_path = file_to_temp_file(image, dir=".")
|
60 |
result = fal_client.run(
|
61 |
"fal-ai/nano-banana/edit",
|
62 |
arguments={
|
63 |
"prompt": prompt,
|
64 |
-
"image_url": temp_file_path,
|
65 |
},
|
66 |
)
|
67 |
output_images.append(result["images"][0]["url"])
|
|
|
2 |
import fal_client
|
3 |
import os
|
4 |
from huggingface_hub import HfApi, whoami
|
|
|
5 |
|
6 |
try:
|
7 |
FAL_KEY = os.getenv("FAL_KEY")
|
|
|
25 |
|
26 |
if image:
|
27 |
# Image-to-Image
|
|
|
28 |
result = fal_client.run(
|
29 |
"fal-ai/nano-banana/edit",
|
30 |
arguments={
|
|
|
54 |
|
55 |
output_images = []
|
56 |
for image in images:
|
|
|
57 |
result = fal_client.run(
|
58 |
"fal-ai/nano-banana/edit",
|
59 |
arguments={
|
60 |
"prompt": prompt,
|
61 |
+
"image_url": fal_client.upload_file(temp_file_path),
|
62 |
},
|
63 |
)
|
64 |
output_images.append(result["images"][0]["url"])
|