import gradio as gr | |
import os | |
# Check if running on Hugging Face Spaces | |
import os | |
print(os.environ) | |
def is_running_in_space(): | |
return "SPACE_ID" in os.environ | |
if is_running_in_space(): | |
print("Running in Hugging Face Space") | |
else: | |
print("Running locally") | |
def greet(name, intensity): | |
return "Hello, " + name + "!" * int(intensity) | |
demo = gr.Interface( | |
fn=greet, | |
inputs=["text", "slider"], | |
outputs=["text"], | |
) | |
demo.launch() | |