Polish

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Model Card for Model ID

This modelcard aims to be a base template for new models. It has been generated using this raw template.

Model Details

Model Description

  • Developed by: [More Information Needed]
  • Funded by [optional]: [More Information Needed]
  • Shared by [optional]: [More Information Needed]
  • Model type: [More Information Needed]
  • Language(s) (NLP): [More Information Needed]
  • License: [More Information Needed]
  • Finetuned from model [optional]: [More Information Needed]

Model Sources [optional]

  • Repository: [More Information Needed]
  • Paper [optional]: [More Information Needed]
  • Demo [optional]: [More Information Needed]

Uses

Direct Use

[More Information Needed]

Downstream Use [optional]

[More Information Needed]

Out-of-Scope Use

[More Information Needed]

Bias, Risks, and Limitations

[More Information Needed]

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.

How to Get Started with the Model

Use the code below to get started with the model.

[More Information Needed]

Training Details

Training Data

[More Information Needed]

Training Procedure

Preprocessing [optional]

[More Information Needed]

Training Hyperparameters

  • Training regime: [More Information Needed]

Speeds, Sizes, Times [optional]

[More Information Needed]

Evaluation

Testing Data, Factors & Metrics

Testing Data

[More Information Needed]

Factors

[More Information Needed]

Metrics

[More Information Needed]

Results

[More Information Needed]

Summary

Model Examination [optional]

[More Information Needed]

Environmental Impact

Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).

  • Hardware Type: [More Information Needed]
  • Hours used: [More Information Needed]
  • Cloud Provider: [More Information Needed]
  • Compute Region: [More Information Needed]
  • Carbon Emitted: [More Information Needed]

Technical Specifications [optional]

Model Architecture and Objective

[More Information Needed]

Compute Infrastructure

[More Information Needed]

Hardware

[More Information Needed]

Software

[More Information Needed]

Citation [optional]

BibTeX:

[More Information Needed]

APA:

[More Information Needed]

Glossary [optional]

[More Information Needed]

More Information [optional]

[More Information Needed]

Model Card Authors [optional]

[More Information Needed]

Model Card Contact

[More Information Needed]

Copyright 2026 Luma AI Space Contributors

Licensed under the Apache License, Version 2.0

import os import time import gradio as gr from lumaai import LumaAI

Pobranie klucza z bezpiecznych sekretów Hugging Face Space

API_KEY = os.environ.get("LUMAAI_API_KEY")

def generate_content(model, prompt, image, aspect_ratio, resolution, duration, loop): if not API_KEY: return None, "Błąd: Brak klucza LUMAAI_API_KEY w ustawieniach (Secrets) tego Space."

if not prompt:
    return None, "Proszę podać opis (prompt) dla modelu."

client = LumaAI(api_key=API_KEY)

try:
    # Konfiguracja zadania w zależności od wybraného modelu
    payload = {
        "model": model,
        "prompt": prompt
    }
    
    # Jeśli dodano obraz (Image-to-Video)
    if image is not None:
        payload["keyframes"] = {
            "frame0": {
                "type": "image",
                "url": image
            }
        }
        
    # Dodatkowe parametry dla wideo
    if "ray" in model:
        payload["aspect_ratio"] = aspect_ratio
        payload["resolution"] = resolution
        payload["duration"] = duration
        payload["loop"] = loop

    # 1. Wysłanie żądania utworzenia
    generation = client.generations.create(**payload)
    job_id = generation.id
    
    # 2. Pętla Polling (Sprawdzanie statusu)
    max_attempts = 60
    for _ in range(max_attempts):
        time.sleep(5)
        status = client.generations.get(id=job_id)
        
        if status.state == "completed":
            # Zwrócenie wideo lub obrazu w zależności od asetu końcowego
            output_url = status.assets.video if status.assets.video else status.assets.image
            return output_url, "Sukces! Wygenerowano pomyślnie."
            
        if status.state == "failed":
            reason = status.failure_reason.lower()
            # Przechwytywanie filtrów NSFW / Safety zgodnie z polityką Luma AI
            if any(x in reason for x in ["safety", "moderation", "nsfw"]):
                return None, "Generowanie odrzucone: Wykryto treści naruszające filtry bezpieczeństwa (NSFW/Safety)."
            return None, f"Generowanie nie powiodło się: {status.failure_reason}"
            
    return None, "Przekroczono limit czasu oczekiwania na serwer Luma AI."
    
except Exception as e:
    return None, f"Błąd krytyczny aplikacji: {str(e)}"

Budowanie interfejsu graficznego Gradio (UI)

with gr.Blocks(theme=gr.themes.Soft()) as demo: gr.Markdown("# 🎬 Luma AI - Interfejs Generatywny (Ray 2 & Photon)") gr.Markdown("Wdrożone na licencji Apache 2.0. Pamiętaj dodać LUMAAI_API_KEY w zakładce Settings -> Variables and Secrets swojego Space.")

with gr.Row():
    with gr.Column():
        model = gr.Dropdown(
            choices=["ray-2", "ray-flash-2", "photon-1", "photon-flash-1"], 
            value="ray-2", 
            label="Silnik (Model)"
        )
        prompt = gr.TextArea(
            label="Opis tekstowy (Prompt)", 
            placeholder="Opisz co ma znaleźć się na wideo/obrazie...",
            max_length=1500
        )
        image_input = gr.Image(label="Obraz wejściowy (Opcjonalny dla Image-to-Video)", type="filepath")
        
        with gr.Accordion("Ustawienia zaawansowane (Tylko dla modeli Ray/Wideo)", open=False):
            aspect_ratio = gr.Radio(choices=["1:1", "16:9", "9:16", "4:3", "3:4"], value="16:9", label="Proporcje ekranu")
            resolution = gr.Dropdown(choices=["540p", "720p", "1080p"], value="720p", label="Rozdzielczość")
            duration = gr.Radio(choices=["5s", "9s"], value="5s", label="Czas trwania")
            loop = gr.Checkbox(value=False, label="Pętla (Loop wideo)")
            
        submit_btn = gr.Button("Generuj", variant="primary")
        
    with gr.Column():
        # Komponent automatycznie obsłuży zarówno plik .mp4 jak i .png/.jpg
        output_media = gr.PlayableVideo(label="Wygenerowany materiał")
        status_output = gr.Textbox(label="Status / Logi systemu", interactive=False)

submit_btn.click(
    fn=generate_content,
    inputs=[model, prompt, image_input, aspect_ratio, resolution, duration, loop],
    outputs=[output_media, status_output]

Skorelowane z wytycznymi wdrożeń Hugging Face Spaces

demo.launch()

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for K4rollo86/K1