Spaces:
Runtime error
Runtime error
Fix: Strict pinning and dual-layer safety patch for HfFolder
Browse files
app.py
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
import numpy as np
|
| 5 |
from PIL import Image
|
| 6 |
import tempfile
|
| 7 |
-
import os
|
| 8 |
|
| 9 |
-
#
|
| 10 |
BASE_MODEL = "cyberdelia/CyberRealisticPony"
|
| 11 |
LTX_MODEL = "Lightricks/LTX-Video"
|
| 12 |
LTX_NSFW_LORA = "Lora-Daddy/Ltx2.3-real-nudity-early-alpha-30k-steps"
|
|
@@ -55,7 +75,6 @@ def generate_video(prompt, init_image, lora_scale):
|
|
| 55 |
export_to_video(output.frames[0], tmp.name, fps=24)
|
| 56 |
return tmp.name
|
| 57 |
|
| 58 |
-
# INTERFAZ
|
| 59 |
with gr.Blocks(title="Image Utility v2.1") as demo:
|
| 60 |
gr.HTML("<h1 style='text-align:center;'>🛠 Image Processing Utility v2.1.4</h1>")
|
| 61 |
with gr.Tabs():
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
# --- PARCHE DE SEGURIDAD ABSOLUTA (HfFolder) ---
|
| 5 |
+
try:
|
| 6 |
+
import huggingface_hub
|
| 7 |
+
# Si la pieza falta, la inyectamos manualmente ANTES de cargar Gradio
|
| 8 |
+
if not hasattr(huggingface_hub, "HfFolder"):
|
| 9 |
+
class MockHfFolder:
|
| 10 |
+
@staticmethod
|
| 11 |
+
def get_token(): return os.getenv("HF_TOKEN")
|
| 12 |
+
@staticmethod
|
| 13 |
+
def save_token(token): pass
|
| 14 |
+
@staticmethod
|
| 15 |
+
def delete_token(): pass
|
| 16 |
+
huggingface_hub.HfFolder = MockHfFolder
|
| 17 |
+
sys.modules["huggingface_hub.HfFolder"] = MockHfFolder
|
| 18 |
+
except:
|
| 19 |
+
pass
|
| 20 |
+
# -----------------------------------------------
|
| 21 |
+
|
| 22 |
import spaces
|
| 23 |
import gradio as gr
|
| 24 |
import torch
|
| 25 |
import numpy as np
|
| 26 |
from PIL import Image
|
| 27 |
import tempfile
|
|
|
|
| 28 |
|
| 29 |
+
# CONFIG
|
| 30 |
BASE_MODEL = "cyberdelia/CyberRealisticPony"
|
| 31 |
LTX_MODEL = "Lightricks/LTX-Video"
|
| 32 |
LTX_NSFW_LORA = "Lora-Daddy/Ltx2.3-real-nudity-early-alpha-30k-steps"
|
|
|
|
| 75 |
export_to_video(output.frames[0], tmp.name, fps=24)
|
| 76 |
return tmp.name
|
| 77 |
|
|
|
|
| 78 |
with gr.Blocks(title="Image Utility v2.1") as demo:
|
| 79 |
gr.HTML("<h1 style='text-align:center;'>🛠 Image Processing Utility v2.1.4</h1>")
|
| 80 |
with gr.Tabs():
|