Spaces:
Running
Running
ciover2024
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
|
|
|
|
|
|
3 |
import torch
|
4 |
#from diffusers import FluxControlNetModel
|
5 |
#from diffusers.pipelines import FluxControlNetPipeline
|
@@ -70,6 +73,12 @@ def load_upscaling_model():
|
|
70 |
# Preload the model once
|
71 |
#upscale_pipeline = load_upscaling_model()
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
def resize_image(orig_image):
|
74 |
aspect_ratio = orig_image.height / orig_image.width
|
75 |
old_width = orig_image.width
|
|
|
1 |
import gradio as gr
|
2 |
from PIL import Image
|
3 |
+
import base64
|
4 |
+
from io import BytesIO
|
5 |
+
|
6 |
import torch
|
7 |
#from diffusers import FluxControlNetModel
|
8 |
#from diffusers.pipelines import FluxControlNetPipeline
|
|
|
73 |
# Preload the model once
|
74 |
#upscale_pipeline = load_upscaling_model()
|
75 |
|
76 |
+
def encode_image(orig_image):
|
77 |
+
buffered = BytesIO()
|
78 |
+
orig_image.save(buffered, format="JPEG")
|
79 |
+
img_str = base64.b64encode(buffered.getvalue())
|
80 |
+
return img_str
|
81 |
+
|
82 |
def resize_image(orig_image):
|
83 |
aspect_ratio = orig_image.height / orig_image.width
|
84 |
old_width = orig_image.width
|