Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client
|
3 |
-
import base64
|
4 |
-
from PIL import Image
|
5 |
-
import io
|
6 |
|
7 |
# Initialize the client
|
8 |
client = Client("radames/Enhance-This-HiDiffusion-SDXL")
|
9 |
|
10 |
-
def pil_to_base64(img):
|
11 |
-
buffered = io.BytesIO()
|
12 |
-
img.save(buffered, format="PNG")
|
13 |
-
return base64.b64encode(buffered.getvalue()).decode('utf-8')
|
14 |
-
|
15 |
def enhance_image(image, prompt):
|
16 |
-
# Convert the image to base64
|
17 |
-
image_base64 = pil_to_base64(image)
|
18 |
-
|
19 |
# Use the client to predict the result
|
20 |
-
|
21 |
-
|
22 |
-
# Convert result from base64 to PIL Image
|
23 |
-
result_image = Image.open(io.BytesIO(base64.b64decode(result_base64)))
|
24 |
-
return result_image
|
25 |
|
26 |
# Create the Gradio interface
|
27 |
iface = gr.Interface(
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client
|
|
|
|
|
|
|
3 |
|
4 |
# Initialize the client
|
5 |
client = Client("radames/Enhance-This-HiDiffusion-SDXL")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
def enhance_image(image, prompt):
|
|
|
|
|
|
|
8 |
# Use the client to predict the result
|
9 |
+
result = client.predict(image, prompt, api_name="/predict")
|
10 |
+
return result
|
|
|
|
|
|
|
11 |
|
12 |
# Create the Gradio interface
|
13 |
iface = gr.Interface(
|