File size: 1,283 Bytes
9a37ff5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bc1f3c5
 
 
9a37ff5
 
 
 
 
56e4867
9a37ff5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import gradio as gr
import spaces



@spaces.GPU
def RunGpu(p):
    return p;


def ZeroGpuTest(p):
    try:
        return RunGpu(p)
    except Exception as e:
        return e;




with gr.Blocks() as demo:
    gr.Markdown("Log with you Hugging Face account to more gpu credits!")
    gr.LoginButton()

    gr.Markdown("""
        This space demonstrates a problem with ZeroGPU and the public host link of the space, which is the link used when you embed it.  
        Steps to reproduce:  
        - Just type something in the textbox below, then click the submit button.  
        - If you have minutes left, the script runs fine.  
        - 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>
        - Try doing the same thing. You will receive an error related to ZeroGPU minutes being left!  
    """)


    text = gr.Textbox(submit_btn = True);
    result = gr.Textbox()

    text.submit(ZeroGpuTest,[text],[result])       
        
        
        
    
    
    
    
    
    



if __name__ == "__main__":
    demo.launch(
        share=False,
        debug=False,
        server_port=7860,
        server_name="0.0.0.0",
        allowed_paths=[]
    )