JohnyBonony commited on
Commit
ca70841
·
verified ·
1 Parent(s): 815d01b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -1,10 +1,21 @@
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 tencent/HunyuanVideo 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/tencent/HunyuanVideo", accept_token=button, provider="fal-ai")
9
 
 
 
 
10
  demo.launch()
 
1
  import gradio as gr
2
+ import spaces
3
+
4
+ # Load the remote interface manually
5
+ backend = gr.load("models/tencent/HunyuanVideo", provider="fal-ai")
6
+
7
+ # Define a local function that Hugging Face can track, wrapped with the GPU decorator
8
+ @spaces.GPU
9
+ def predict(*args, **kwargs):
10
+ return backend(*args, **kwargs)
11
 
12
  with gr.Blocks(fill_height=True) as demo:
13
  with gr.Sidebar():
14
  gr.Markdown("# Inference Provider")
15
  gr.Markdown("This Space showcases the tencent/HunyuanVideo model, served by the fal-ai API. Sign in with your Hugging Face account to use this API.")
16
  button = gr.LoginButton("Sign in")
 
17
 
18
+ # Create an interface mapping to our decorated function
19
+ gr.Interface.from_pipeline(backend, fn=predict, accept_token=button)
20
+
21
  demo.launch()