marahaa commited on
Commit
ef31016
·
verified ·
1 Parent(s): e935012

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -24
app.py CHANGED
@@ -1,29 +1,10 @@
1
- import gradio as gr
2
  from modelscope.pipelines import pipeline
3
- from modelscope.utils.constant import Tasks
4
- import os
5
 
6
- # تحميل الموديل من ModelScope
7
  video_gen = pipeline(
8
- task=Tasks.text_to_video_synthesis,
9
- model='damo-vilab/modelscope-text-to-video-synthesis',
10
- model_revision='v1.0.2'
11
  )
12
 
13
- # دالة التوليد
14
- def generate_video(prompt):
15
- result = video_gen({'text': prompt})
16
- video_path = result['output_video']
17
- return video_path
18
-
19
- # واجهة Gradio
20
- demo = gr.Interface(
21
- fn=generate_video,
22
- inputs=gr.Textbox(label="اكتب وصف الفيديو 🎬"),
23
- outputs=gr.Video(label="الفيديو الناتج 🎥"),
24
- title="Text-to-Video باستخدام ModelScope",
25
- description="حوّل النصوص لفيديوهات باستخدام الذكاء الاصطناعي 🤖✨"
26
- )
27
-
28
- # تشغيل التطبيق
29
- demo.launch()
 
 
1
  from modelscope.pipelines import pipeline
2
+ from modelscope.outputs import OutputKeys
 
3
 
 
4
  video_gen = pipeline(
5
+ task="text-to-video-synthesis",
6
+ model="damo-vilab/modelscope-damo-text-to-video-synthesis"
 
7
  )
8
 
9
+ output = video_gen({'text': 'A panda eating bamboo on a rock'})
10
+ print('✅ Video saved to:', output[OutputKeys.OUTPUT_VIDEO])