Commit ·
554ee56
1
Parent(s): f6ede5b
new update fix
Browse files
app.py
CHANGED
|
@@ -809,6 +809,19 @@ def minecraftify(
|
|
| 809 |
return _minecraftify_image(image, steps, guidance_scale, seed, extra_details)
|
| 810 |
|
| 811 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 812 |
def capture_live_frame(image: Image.Image):
|
| 813 |
global _live_latest_frame, _live_latest_frame_id, _live_capture_count
|
| 814 |
|
|
@@ -828,7 +841,6 @@ def capture_live_frame(image: Image.Image):
|
|
| 828 |
return None
|
| 829 |
|
| 830 |
|
| 831 |
-
@spaces.GPU(duration=120)
|
| 832 |
def minecraftify_live_loop(
|
| 833 |
steps: int,
|
| 834 |
guidance_scale: float,
|
|
@@ -858,7 +870,7 @@ def minecraftify_live_loop(
|
|
| 858 |
|
| 859 |
last_processed_frame_id = frame_id
|
| 860 |
log_event(f"Processing newest live frame id={frame_id}")
|
| 861 |
-
output =
|
| 862 |
yield output
|
| 863 |
|
| 864 |
|
|
@@ -985,7 +997,7 @@ with gr.Blocks(**BLOCKS_KWARGS) as demo:
|
|
| 985 |
|
| 986 |
with gr.Accordion("⚙️ Advanced Settings", open=False):
|
| 987 |
steps = gr.Slider(
|
| 988 |
-
minimum=
|
| 989 |
label="⚡ Inference Steps",
|
| 990 |
info="Higher = better quality, slower generation",
|
| 991 |
)
|
|
@@ -1030,7 +1042,7 @@ with gr.Blocks(**BLOCKS_KWARGS) as demo:
|
|
| 1030 |
<div class="mc-tip-title">📖 TIPS & TRICKS</div>
|
| 1031 |
<div class="mc-divider" style="margin: 10px 0;"></div>
|
| 1032 |
<ul style="padding-left: 20px; margin: 8px 0;">
|
| 1033 |
-
<li>🎯 <strong style="color:#7CB342;">Inference steps:</strong>
|
| 1034 |
<li>🐺 <strong style="color:#7CB342;">Still too real?</strong> Describe tricky parts in the details box (e.g. "convert the dog into a wolf mob").</li>
|
| 1035 |
<li>⏱️ <strong style="color:#7CB342;">Live mode:</strong> The camera stream prioritizes the newest frame whenever the model is free.</li>
|
| 1036 |
<li>🎲 <strong style="color:#7CB342;">Variations:</strong> Change the seed to get different Minecraft interpretations of the same photo.</li>
|
|
|
|
| 809 |
return _minecraftify_image(image, steps, guidance_scale, seed, extra_details)
|
| 810 |
|
| 811 |
|
| 812 |
+
@spaces.GPU(duration=60)
|
| 813 |
+
def _minecraftify_live_frame(
|
| 814 |
+
frame: Image.Image,
|
| 815 |
+
steps: int,
|
| 816 |
+
guidance_scale: float,
|
| 817 |
+
seed: int,
|
| 818 |
+
extra_details: str,
|
| 819 |
+
):
|
| 820 |
+
"""GPU-wrapped inference for individual live frames."""
|
| 821 |
+
log_event(f"GPU-allocated: Processing live frame with steps={steps}")
|
| 822 |
+
return _minecraftify_image(frame, steps, guidance_scale, seed, extra_details)
|
| 823 |
+
|
| 824 |
+
|
| 825 |
def capture_live_frame(image: Image.Image):
|
| 826 |
global _live_latest_frame, _live_latest_frame_id, _live_capture_count
|
| 827 |
|
|
|
|
| 841 |
return None
|
| 842 |
|
| 843 |
|
|
|
|
| 844 |
def minecraftify_live_loop(
|
| 845 |
steps: int,
|
| 846 |
guidance_scale: float,
|
|
|
|
| 870 |
|
| 871 |
last_processed_frame_id = frame_id
|
| 872 |
log_event(f"Processing newest live frame id={frame_id}")
|
| 873 |
+
output = _minecraftify_live_frame(frame, steps, guidance_scale, seed, extra_details)
|
| 874 |
yield output
|
| 875 |
|
| 876 |
|
|
|
|
| 997 |
|
| 998 |
with gr.Accordion("⚙️ Advanced Settings", open=False):
|
| 999 |
steps = gr.Slider(
|
| 1000 |
+
minimum=2, maximum=15, value=3, step=1,
|
| 1001 |
label="⚡ Inference Steps",
|
| 1002 |
info="Higher = better quality, slower generation",
|
| 1003 |
)
|
|
|
|
| 1042 |
<div class="mc-tip-title">📖 TIPS & TRICKS</div>
|
| 1043 |
<div class="mc-divider" style="margin: 10px 0;"></div>
|
| 1044 |
<ul style="padding-left: 20px; margin: 8px 0;">
|
| 1045 |
+
<li>🎯 <strong style="color:#7CB342;">Inference steps:</strong> 3 is the sweet spot. Go higher for more detail.</li>
|
| 1046 |
<li>🐺 <strong style="color:#7CB342;">Still too real?</strong> Describe tricky parts in the details box (e.g. "convert the dog into a wolf mob").</li>
|
| 1047 |
<li>⏱️ <strong style="color:#7CB342;">Live mode:</strong> The camera stream prioritizes the newest frame whenever the model is free.</li>
|
| 1048 |
<li>🎲 <strong style="color:#7CB342;">Variations:</strong> Change the seed to get different Minecraft interpretations of the same photo.</li>
|