Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
| 17 |
-
|
| 18 |
-
model = pipeline("text-to-video", model="Lightricks/LTX-Video", token=hf_token)
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
def generate_video(
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 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
|