share_space / app.py
unknown
add app
c06d1d5
raw
history blame contribute delete
994 Bytes
# 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()