File size: 1,136 Bytes
dc84e55
 
 
1f493fd
dc84e55
 
1f493fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745d537
1f493fd
 
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
31
32
33
34
35
36
37
38
39
40
import gradio as gr
import os


HF_TOKEN = os.environ.get("HF_TOKEN")

def main():
    # Your private space ID
    PRIVATE_SPACE_ID = "okeysir/tts-sync-prototype-backend"  
    
    # Create a header for your public app
    with gr.Blocks() as demo:
        
        # Load from private space using the correct syntax
        try:
            app = gr.load(
                name=PRIVATE_SPACE_ID,
                src="spaces",
                token=HF_TOKEN  
            )
            # Embed the loaded app
            
        except Exception as e:
            gr.Markdown(f"""
            ## Error loading application
            
            There was an error connecting to the backend service. This could be due to:
            - The backend service is not running
            - Authentication issues with the private space
            - Network connectivity problems
            
            Please contact the administrator if this problem persists.
            """)
            gr.Markdown(f"Technical details (for administrators): {str(e)}")
    
    # Launch the app
    demo.launch()

if __name__ == "__main__":
    main()