File size: 994 Bytes
c06d1d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# app.py in PUBLIC space
import gradio as gr
import os
hf_token = os.getenv("hf_token")
# Load the private space
demo = gr.load(
    name="spaces/Mapraw/UnHealthyChick",  # Your private space name
    src="spaces",
    token=hf_token,  # Add the token here
    title="Public Demo",
    description="This is a public interface to our private model"
)

# Optional: Add public wrapper functions
def public_interface(input_text):
    # You can add preprocessing/postprocessing here
    result = demo(input_text)
    return result

# Create public interface with additional features
with gr.Blocks() as demo:
    gr.Markdown("# Public Demo Interface")
    gr.Markdown("This demo interfaces with a private backend")
    
    with gr.Row():
        input_box = gr.Textbox(label="Input")
        output_box = gr.Textbox(label="Output")
    
    submit_btn = gr.Button("Submit")
    submit_btn.click(
        fn=public_interface,
        inputs=input_box,
        outputs=output_box
    )

demo.launch()