rrg92/zerogpu-embed-problem
0
1import gradio as gr2import spaces3 4 5 6@spaces.GPU7def RunGpu(p):8 return p;9 10 11def ZeroGpuTest(p):12 try:13 return RunGpu(p)14 except Exception as e:15 return e;16 17 18 19 20with gr.Blocks() as demo:21 gr.Markdown("Log with you Hugging Face account to more gpu credits!")22 gr.LoginButton()23 24 gr.Markdown("""25 This space demonstrates a problem with ZeroGPU and the public host link of the space, which is the link used when you embed it. 26 Steps to reproduce: 27 - Just type something in the textbox below, then click the submit button. 28 - If you have minutes left, the script runs fine. 29 - Now, access the public host URL of this space: <a target="_blank" href="https://rrg92-zerogpu-embed-problem.hf.space">https://rrg92-zerogpu-embed-problem.hf.space</a>30 - Try doing the same thing. You will receive an error related to ZeroGPU minutes being left! 31 """)32 33 34 text = gr.Textbox(submit_btn = True);35 result = gr.Textbox()36 37 text.submit(ZeroGpuTest,[text],[result]) 38 39 40 41 42 43 44 45 46 47 48 49 50if __name__ == "__main__":51 demo.launch(52 share=False,53 debug=False,54 server_port=7860,55 server_name="0.0.0.0",56 allowed_paths=[]57 )58 