Update app.py
Browse files
app.py
CHANGED
|
@@ -7,20 +7,20 @@ import tempfile
|
|
| 7 |
# DO NOT create a global client for paid apps
|
| 8 |
# Each user's client will be created using their OAuth token
|
| 9 |
|
| 10 |
-
def generate_video_with_auth(image, prompt,
|
| 11 |
"""
|
| 12 |
Generate a video from an image using the Ovi model with authentication check.
|
| 13 |
|
| 14 |
Args:
|
| 15 |
image: Input image (PIL Image or file path)
|
| 16 |
prompt: Text prompt describing the desired motion/animation
|
| 17 |
-
|
| 18 |
progress: Gradio progress tracker
|
| 19 |
|
| 20 |
Returns:
|
| 21 |
Path to the generated video file
|
| 22 |
"""
|
| 23 |
-
if
|
| 24 |
raise gr.Error("Please sign in with Hugging Face to use this paid app")
|
| 25 |
|
| 26 |
if image is None:
|
|
@@ -49,7 +49,7 @@ def generate_video_with_auth(image, prompt, profile: gr.OAuthProfile | None, pro
|
|
| 49 |
# Do NOT use bill_to parameter - this makes the USER pay, not HuggingFace
|
| 50 |
client = InferenceClient(
|
| 51 |
provider="fal-ai",
|
| 52 |
-
api_key=
|
| 53 |
)
|
| 54 |
|
| 55 |
# Generate video using the inference client
|
|
|
|
| 7 |
# DO NOT create a global client for paid apps
|
| 8 |
# Each user's client will be created using their OAuth token
|
| 9 |
|
| 10 |
+
def generate_video_with_auth(image, prompt, token: gr.OAuthToken | None, progress=gr.Progress()):
|
| 11 |
"""
|
| 12 |
Generate a video from an image using the Ovi model with authentication check.
|
| 13 |
|
| 14 |
Args:
|
| 15 |
image: Input image (PIL Image or file path)
|
| 16 |
prompt: Text prompt describing the desired motion/animation
|
| 17 |
+
token: OAuth token for authentication
|
| 18 |
progress: Gradio progress tracker
|
| 19 |
|
| 20 |
Returns:
|
| 21 |
Path to the generated video file
|
| 22 |
"""
|
| 23 |
+
if token is None or not getattr(token, "token", None):
|
| 24 |
raise gr.Error("Please sign in with Hugging Face to use this paid app")
|
| 25 |
|
| 26 |
if image is None:
|
|
|
|
| 49 |
# Do NOT use bill_to parameter - this makes the USER pay, not HuggingFace
|
| 50 |
client = InferenceClient(
|
| 51 |
provider="fal-ai",
|
| 52 |
+
api_key=token.token, # Use token.token
|
| 53 |
)
|
| 54 |
|
| 55 |
# Generate video using the inference client
|