breezywaves commited on
Commit
10c7e34
·
verified ·
1 Parent(s): 0014399

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -1,8 +1,6 @@
1
  import gradio as gr
2
  from dotenv import load_dotenv
3
  import os
4
- from huggingface_hub import login
5
- from transformers import pipeline # assuming the model is a transformer-based pipeline
6
 
7
  # Load environment variables from .env file
8
  load_dotenv()
@@ -10,19 +8,21 @@ load_dotenv()
10
  # Get the token from the environment variable
11
  hf_token = os.getenv("HF_TOKEN")
12
 
13
- # Authenticate with the Hugging Face token
 
14
  login(token=hf_token)
15
 
16
- # Load the model with transformers or another compatible method
17
- # Adjust this based on how your model works; if it's a text-to-video model, it might have a different interface.
18
- model = pipeline("text-to-video", model="Lightricks/LTX-Video", token=hf_token)
19
 
20
- # Set up the Gradio interface
21
- def generate_video(text):
22
- # Use the model to generate a video
23
- video = model(text)
24
- return video # Assuming the model returns a video or similar output
 
25
 
 
26
  interface = gr.Interface(fn=generate_video, inputs="text", outputs="video")
27
 
28
  # Launch the app
 
1
  import gradio as gr
2
  from dotenv import load_dotenv
3
  import os
 
 
4
 
5
  # Load environment variables from .env file
6
  load_dotenv()
 
8
  # Get the token from the environment variable
9
  hf_token = os.getenv("HF_TOKEN")
10
 
11
+ # Authenticate with the Hugging Face token (only necessary if you're using private models)
12
+ from huggingface_hub import login
13
  login(token=hf_token)
14
 
15
+ # Use Gradio to load the model (assuming this is the correct way to load it)
16
+ model_name = "Lightricks/LTX-Video"
 
17
 
18
+ # Create a Gradio interface that connects to the model
19
+ def generate_video(input_text):
20
+ # If your model expects text and outputs video, process here
21
+ model = gr.Interface.load(model_name, provider="huggingface")
22
+ output = model.predict(input_text)
23
+ return output
24
 
25
+ # Set up Gradio interface
26
  interface = gr.Interface(fn=generate_video, inputs="text", outputs="video")
27
 
28
  # Launch the app