EVIRA AI Video Generator Model

Created by Muhammad Taqi. This repository hosts the EVIRA model along with its interactive video generation web interface Evira.safetensors weight.


📂 Repository Files & Code Setup

ALL WRITTEN CODE FOR YOUR PROJECT.

1. app.py (Gradio Web Interface)

import asyncio
import json
import gradio as gr
from huggingface_hub import hf_hub_download

# Model se config aur pipeline code load karna
try:
  config_path = hf_hub_download(
      repo_id="muhammad-taqi512/EVIRA", filename="config.json"
  )
  with open(config_path, "r", encoding="utf-8") as f:
    model_data = json.load(f)
    INVIDIOUS_MIRRORS = model_data.get("invidious_mirrors", [])
    PIPED_MIRRORS = model_data.get("piped_mirrors", [])
    pipeline_code_str = model_data.get("pipeline_code", "")

  # Model ke andar se pipeline function dynamically compile karna
  namespace = {}
  exec(pipeline_code_str, namespace)
  run_pipeline_func = namespace["run_pipeline"]
  print("✅ Model pipeline loaded successfully from EVIRA Model!")
except Exception as e:
  raise RuntimeError(f"❌ Model load karne mein nakami: {e}")


async def generate_from_model(user_prompt):
  yield (
      "<div style='text-align: center; color: #a855f7; font-weight: bold;"
      " padding: 12px; background: rgba(168,85,247,0.1); border-radius:"
      " 8px;'>⏳ EVIRA Neural Model is generating video nodes & rendering"
      " frames... Please wait.</div>",
      "",
      "Status: Generating...",
  )

  # Model ke andar wali execution pipeline call karna
  shorts_html, videos_html, s_count, v_count = await run_pipeline_func(
      user_prompt, INVIDIOUS_MIRRORS, PIPED_MIRRORS
  )

  status_msg = (
      f"✨ **Generation Complete!** Generated: <b>{s_count} Shorts</b> and"
      f" <b>{v_count} Videos</b>."
  )
  yield shorts_html, videos_html, status_msg


# Custom UI CSS
custom_css = """
body { background-color: #0b0f19; color: #f8fafc; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.main-header { text-align: center; margin-bottom: 25px; }
.main-header h1 { font-size: 2.5rem; background: linear-gradient(90deg, #6366f1, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; margin-top: 15px; }
.video-card { background: #1e293b; border: 1px solid #334155; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); transition: transform 0.2s; }
.video-card:hover { transform: translateY(-4px); border-color: #6366f1; }
.preview-container { height: 140px; background: linear-gradient(135deg, #1e1b4b, #311042); position: relative; display: flex; align-items: center; justify-content: center; }
.video-preview { height: 160px; background: linear-gradient(135deg, #0f172a, #1e1b4b); }
.center-logo { width: 45px; height: 45px; background: linear-gradient(135deg, #6366f1, #ec4899); color: white; font-weight: 900; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; box-shadow: 0 0 15px rgba(99,102,241,0.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(99,102,241, 0.7); } 70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(99,102,241, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(99,102,241, 0); } }
.badge { position: absolute; top: 10px; left: 10px; background: #3b82f6; color: white; padding: 3px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: bold; }
.video-badge { background: #ec4899; }
.card-content { padding: 15px; }
.video-card h3 { font-size: 0.95rem; margin-bottom: 6px; color: #f1f5f9; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 2.6em; }
.video-card p { font-size: 0.8rem; color: #94a3b8; margin-bottom: 12px; }
.btn-group { display: flex; gap: 8px; }
.btn-watch { flex: 1; text-align: center; background: #6366f1; color: white; padding: 6px 0; border-radius: 6px; text-decoration: none; font-size: 0.8rem; font-weight: 600; }
.btn-watch:hover { background: #4f46e5; }
.btn-share { flex: 1; background: #334155; color: #f8fafc; border: none; padding: 6px 0; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.btn-share:hover { background: #475569; }
.status-box { background: #1e293b; padding: 10px 15px; border-radius: 8px; border-left: 4px solid #6366f1; margin-bottom: 15px; font-size: 0.95rem; }
"""

with gr.Blocks(css=custom_css) as demo:
  gr.HTML("""
        <div class="main-header">
            <h1>✨ EVIRA AI Video Generator</h1>
            <p>100% Model-Driven Architecture (Model: <code>muhammad-taqi512/EVIRA</code>)</p>
        </div>
    """)

  with gr.Row():
    prompt_input = gr.Textbox(
        label="Enter Your AI Video Prompt",
        placeholder="e.g. cinematic drone shot, funny cat...",
        scale=4,
    )
    submit_btn = gr.Button("🚀 Generate AI Video", variant="primary", scale=1)

  status_output = gr.Markdown(
      value="Status: Ready to generate...", elem_classes=["status-box"]
  )

  with gr.Tabs():
    with gr.TabItem("📱 AI Shorts (9:16 | <1 min)"):
      shorts_output = gr.HTML(
          value=(
              "<p style='color: #64748b; text-align: center; padding:"
              " 20px;'>Prompt enter karein...</p>"
          )
      )
    with gr.TabItem("🎬 Full Videos (16:9 | <1 min)"):
      videos_output = gr.HTML(
          value=(
              "<p style='color: #64748b; text-align: center; padding:"
              " 20px;'>Prompt enter karein...</p>"
          )
      )

  submit_btn.click(
      fn=generate_from_model,
      inputs=prompt_input,
      outputs=[shorts_output, videos_output, status_output],
  )
  prompt_input.submit(
      fn=generate_from_model,
      inputs=prompt_input,
      outputs=[shorts_output, videos_output, status_output],
  )

if __name__ == "__main__":
  demo.launch(server_name="0.0.0.0", server_port=7860)

---

## 📂 Repository Files & Code Setup

ALL WRITTEN CODE FOR YOUR PROJECT.

### 2. `requirements.txt` (Requirements FOR PROJECT)
```requirements.txt
gradio
httpx
safetensors
torch
huggingface_hub
Downloads last month
69
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support