Spaces:
Build error
Build error
Commit
•
50950af
1
Parent(s):
79ca44d
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,8 @@ from styleclip.styleclip_global import project_code_with_styleclip, style_tensor
|
|
23 |
|
24 |
import clip
|
25 |
|
|
|
|
|
26 |
model_dir = "models"
|
27 |
os.makedirs(model_dir, exist_ok=True)
|
28 |
|
@@ -411,7 +413,20 @@ with blocks:
|
|
411 |
|
412 |
|
413 |
def my_inference_function(image,text):
|
414 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
|
416 |
gradio_interface = gr.Interface(
|
417 |
fn = my_inference_function,
|
|
|
23 |
|
24 |
import clip
|
25 |
|
26 |
+
import base64
|
27 |
+
|
28 |
model_dir = "models"
|
29 |
os.makedirs(model_dir, exist_ok=True)
|
30 |
|
|
|
413 |
|
414 |
|
415 |
def my_inference_function(image,text):
|
416 |
+
img_dir = tempfile.mkdtemp()
|
417 |
+
|
418 |
+
img_path = os.path.join(img_dir, f"out_111.jpg")
|
419 |
+
decodedData = base64.b64decode((image))
|
420 |
+
|
421 |
+
print("----- my_inference_function img_path -----")
|
422 |
+
print(img_path)
|
423 |
+
|
424 |
+
# Write Image from Base64 File
|
425 |
+
imgFile = open(img_path, 'wb')
|
426 |
+
imgFile.write(decodedData)
|
427 |
+
imgFile.close()
|
428 |
+
|
429 |
+
return editor.predict(img_path,[text])
|
430 |
|
431 |
gradio_interface = gr.Interface(
|
432 |
fn = my_inference_function,
|