File size: 785 Bytes
d48e6dd
 
e09b437
7909f26
 
e09b437
 
 
 
 
 
 
 
 
f0e4ecc
40c9f46
e09b437
 
 
 
 
 
 
 
 
 
 
 
d48e6dd
e09b437
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import gradio as gr
import os
from gradio_client import Client

hf_token = os.environ.get("HF_TOKEN")
private_space = os.environ.get("PRIVATE_SPACE")

# Load Space hoặc model đã deploy
client = Client(private_space, hf_token=hf_token)
# Tạo UI tùy chỉnh
def call_remote_space(text):
    return client.predict(text)

# Tạo UI local

with gr.Blocks() as demo:
    gr.Markdown("Get Access Token Facebook")
    
    txt = gr.Textbox(label="Nhập", placeholder="Nhập Cookie....")
    
    with gr.Row():
        submit = gr.Button("Submit")
        clear = gr.Button("Clear")
    
    out = gr.Textbox(label="Kết quả", interactive=False)
    
    submit.click(call_remote_space, inputs=txt, outputs=out)
    clear.click(lambda: "", inputs=None, outputs=txt)

demo.launch()