File size: 460 Bytes
d090151
ec9b460
 
 
2e95c9c
 
 
b29772e
 
 
2e95c9c
edca994
2e95c9c
 
 
 
 
 
d090151
 
 
 
 
 
 
 
 
 
 
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
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()