Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,25 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
# Load the new model from Shakker-Labs
|
4 |
demo = gr.load("models/Shakker-Labs/AWPortrait-FL")
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
|
4 |
# Load the new model from Shakker-Labs
|
5 |
demo = gr.load("models/Shakker-Labs/AWPortrait-FL")
|
6 |
|
7 |
+
def process_output(*outputs):
|
8 |
+
# Assuming the model returns a tuple, and the first element is the image
|
9 |
+
if isinstance(outputs, tuple):
|
10 |
+
# Extract the image from the tuple
|
11 |
+
image = outputs[0]
|
12 |
+
return image
|
13 |
+
return outputs
|
14 |
+
|
15 |
+
# Create a wrapper to process the output correctly
|
16 |
+
def wrapped_inference(*inputs):
|
17 |
+
outputs = demo(*inputs)
|
18 |
+
return process_output(*outputs)
|
19 |
+
|
20 |
+
# Launch the Gradio interface with the corrected output processing
|
21 |
+
gr.Interface(
|
22 |
+
wrapped_inference,
|
23 |
+
demo.inputs,
|
24 |
+
demo.outputs,
|
25 |
+
).launch()
|