akclick1401 commited on
Commit
6dd1cb2
·
verified ·
1 Parent(s): 4eed8fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -1,10 +1,16 @@
1
  import gradio as gr
 
2
 
3
- with gr.Blocks(fill_height=True) as demo:
4
- with gr.Sidebar():
5
- gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the Wan-AI/Wan2.1-T2V-14B model, served by the fal-ai API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/Wan-AI/Wan2.1-T2V-14B", accept_token=button, provider="fal-ai")
9
-
10
- demo.launch()
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import AutoModel, AutoTokenizer # hoặc các thành phần cần thiết
3
 
4
+ # Tải hình và tokenizer
5
+ model = AutoModel.from_pretrained("Wan-AI/Wan2.1-T2V-14B")
6
+ tokenizer = AutoTokenizer.from_pretrained("Wan-AI/Wan2.1-T2V-14B")
7
+
8
+ # Hàm xử lý đầu vào
9
+ def generate_video(text):
10
+ inputs = tokenizer(text, return_tensors="pt")
11
+ outputs = model(**inputs) # Điều chỉnh theo cách mô hình hoạt động
12
+ return outputs # Trả về video hoặc định dạng phù hợp
13
+
14
+ # Tạo giao diện Gradio
15
+ iface = gr.Interface(fn=generate_video, inputs="text", outputs="video")
16
+ iface.launch(share=True)