rrg92's picture
Update app.py
bc1f3c5 verified
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=[]
)