Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,6 @@ import requests
|
|
| 4 |
import json
|
| 5 |
from loguru import logger
|
| 6 |
from pathlib import Path
|
| 7 |
-
from dotenv import load_dotenv
|
| 8 |
-
|
| 9 |
-
# Za艂aduj zmienne 艣rodowiskowe z pliku .env
|
| 10 |
-
load_dotenv()
|
| 11 |
|
| 12 |
# Konfiguracja logowania
|
| 13 |
logger.add("video_generation.log", rotation="10 MB")
|
|
@@ -18,13 +14,10 @@ class VideoGenerator:
|
|
| 18 |
STATUS_URL = "https://api.minimaxi.chat/v1/query/video_generation"
|
| 19 |
RETRIEVE_URL = "https://api.minimaxi.chat/v1/files/retrieve"
|
| 20 |
|
| 21 |
-
def __init__(self):
|
| 22 |
-
self.api_key =
|
| 23 |
self.output_dir = Path("generated_videos")
|
| 24 |
self.output_dir.mkdir(exist_ok=True)
|
| 25 |
-
|
| 26 |
-
if not self.api_key:
|
| 27 |
-
raise ValueError("MINIMAX_API_KEY not found in environment variables")
|
| 28 |
|
| 29 |
def invoke_video_generation(self, prompt: str, optimize_prompt: bool = True) -> str:
|
| 30 |
"""
|
|
@@ -178,9 +171,12 @@ class VideoGenerator:
|
|
| 178 |
raise
|
| 179 |
|
| 180 |
def main():
|
|
|
|
|
|
|
|
|
|
| 181 |
try:
|
| 182 |
-
#
|
| 183 |
-
generator = VideoGenerator()
|
| 184 |
|
| 185 |
# Z optymalizacj膮 promptu (domy艣lnie)
|
| 186 |
result_path = generator.generate_video(
|
|
|
|
| 4 |
import json
|
| 5 |
from loguru import logger
|
| 6 |
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
# Konfiguracja logowania
|
| 9 |
logger.add("video_generation.log", rotation="10 MB")
|
|
|
|
| 14 |
STATUS_URL = "https://api.minimaxi.chat/v1/query/video_generation"
|
| 15 |
RETRIEVE_URL = "https://api.minimaxi.chat/v1/files/retrieve"
|
| 16 |
|
| 17 |
+
def __init__(self, api_key: str):
|
| 18 |
+
self.api_key = api_key
|
| 19 |
self.output_dir = Path("generated_videos")
|
| 20 |
self.output_dir.mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def invoke_video_generation(self, prompt: str, optimize_prompt: bool = True) -> str:
|
| 23 |
"""
|
|
|
|
| 171 |
raise
|
| 172 |
|
| 173 |
def main():
|
| 174 |
+
# Tw贸j API key
|
| 175 |
+
api_key = "your_api_key_here" # Tu wpisz sw贸j klucz API
|
| 176 |
+
|
| 177 |
try:
|
| 178 |
+
# Inicjalizacja generatora z kluczem API
|
| 179 |
+
generator = VideoGenerator(api_key)
|
| 180 |
|
| 181 |
# Z optymalizacj膮 promptu (domy艣lnie)
|
| 182 |
result_path = generator.generate_video(
|