Spaces:
Runtime error
Runtime error
| 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() |