samedche commited on
Commit
1860d86
·
verified ·
1 Parent(s): 2c5fd70

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +4 -6
  2. app.py +50 -0
  3. requirements.txt +6 -0
README.md CHANGED
@@ -1,13 +1,11 @@
1
  ---
2
- title: VideoGenerator
3
- emoji: 🌍
4
- colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 6.19.0
8
- python_version: '3.13'
9
  app_file: app.py
10
  pinned: false
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Tozlu Raf Video Uretici
3
+ emoji: 📼
4
+ colorFrom: gray
5
  colorTo: purple
6
  sdk: gradio
 
 
7
  app_file: app.py
8
  pinned: false
9
  ---
10
 
11
+ CPU üzerinde çalışan, kasıtlı olarak eski/basit bir text-to-video modeli (`ali-vilab/text-to-video-ms-1.7b-legacy`).
app.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
4
+ from diffusers.utils import export_to_video
5
+
6
+ # Gerçekten tozlu raflardan: 2023'ün ilkel text-to-video modeli.
7
+ # Inference Providers'ta yok, sadece diffusers ile lokal/Space içinde çalışır.
8
+ MODEL_ID = "ali-vilab/text-to-video-ms-1.7b-legacy"
9
+
10
+ print("Model yükleniyor (CPU), bu birkaç dakika sürebilir...")
11
+ pipe = DiffusionPipeline.from_pretrained(MODEL_ID, torch_dtype=torch.float32)
12
+ pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
13
+ pipe.to("cpu")
14
+ print("Model hazır.")
15
+
16
+
17
+ def video_uret(prompt: str, num_steps: int, num_frames: int):
18
+ if not prompt or not prompt.strip():
19
+ raise gr.Error("Prompt boş olamaz.")
20
+
21
+ video_frames = pipe(
22
+ prompt,
23
+ num_inference_steps=int(num_steps),
24
+ num_frames=int(num_frames),
25
+ ).frames[0]
26
+
27
+ video_path = export_to_video(video_frames)
28
+ return video_path
29
+
30
+
31
+ with gr.Blocks(title="Tozlu Raf Video Üretici") as demo:
32
+ gr.Markdown(
33
+ "# 📼 Tozlu Raf Video Üretici\n"
34
+ f"Model: `{MODEL_ID}` — CPU üzerinde çalışıyor, GPU yok.\n\n"
35
+ "**Uyarı:** Bu Space'te GPU yok. Bir video onlarca dakika sürebilir. "
36
+ "Sabırsızsan adım/kare sayısını düşür."
37
+ )
38
+ prompt = gr.Textbox(
39
+ label="Prompt",
40
+ value="a weird creature with three legs walking backwards, melting face, bad quality vhs glitch",
41
+ )
42
+ with gr.Row():
43
+ steps = gr.Slider(5, 50, value=15, step=1, label="Inference steps (az = hızlı, kalitesiz)")
44
+ frames = gr.Slider(8, 24, value=12, step=1, label="Kare sayısı")
45
+ btn = gr.Button("Üret (sabırlı ol)")
46
+ output = gr.Video(label="Sonuç")
47
+
48
+ btn.click(video_uret, inputs=[prompt, steps, frames], outputs=output)
49
+
50
+ demo.queue(max_size=5).launch()
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ diffusers
2
+ transformers
3
+ accelerate
4
+ torch
5
+ imageio
6
+ imageio-ffmpeg