Spaces:
Sleeping
Sleeping
File size: 846 Bytes
5196830 4c6dff5 2fd17ec 5196830 2fd17ec 5196830 2fd17ec 5196830 4c6dff5 5196830 2fd17ec 4c6dff5 |
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 |
import gradio as gr
import os
def get_space_info():
# Using the specific environment variables for Hugging Face Spaces
space_host = os.getenv("SPACE_HOST", "Unknown")
space_author_name = os.getenv("SPACE_AUTHOR_NAME", "Unknown")
space_repo_name = os.getenv("SPACE_REPO_NAME", "Unknown")
if space_host != "Unknown":
return (
f"Running on Hugging Face Space: {space_author_name}/{space_repo_name}\n"
f"Space Host URL: {space_host}"
)
else:
return "Not running on a Hugging Face Space or environment variables are not set."
# Creating the Gradio interface
interface = gr.Interface(
fn=get_space_info,
inputs=[],
outputs="text",
title="Hugging Face Space Info Checker"
)
# Launching the Gradio interface
if __name__ == "__main__":
interface.launch()
|