Spaces:
Runtime error
Runtime error
File size: 907 Bytes
eba2a56 8c372d3 eba2a56 885b90a 8337ca6 885b90a |
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 |
import gradio as gr
def greet(name):
return "results " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
#When running locally, you won`t have access to this, so you can remove this part
word_list_dataset = load_dataset("stabilityai/word-list", data_files="list.txt", use_auth_token=True)
word_list = word_list_dataset["train"]['text']
is_gpu_busy = False
def infer(prompt):
global is_gpu_busy
samples = 4
steps = 50
scale = 7.9
#When running locally you can also remove this filter
for filter in word_list:
if re.search(rf"\b{filter}\b", prompt):
raise gr.Error("Unsafe content found. Please try again with different prompts.")
#generator = torch.Generator(device=device).manual_seed(seed)
#print("Is GPU busy? ", is_gpu_busy)
images = []
#if(not is_gpu_busy):
# is_gpu_busy = True |