Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from spaces_utils import authenticate
|
3 |
+
|
4 |
+
|
5 |
+
# Load tokens
|
6 |
+
GRADIO_TOKEN = os.environ.get("GRADIO_ORG") # read
|
7 |
+
|
8 |
+
|
9 |
+
# Logs repo path
|
10 |
+
dataset_url = "https://huggingface.co/datasets/sandl/upload_bond_coat_segmentation"
|
11 |
+
dataset_path = "logs_bond_coat_segmentation.csv"
|
12 |
+
|
13 |
+
|
14 |
+
def authenticate_from_public(username, password):
|
15 |
+
return authenticate(username, password, dataset_url, dataset_path)
|
16 |
+
|
17 |
+
|
18 |
+
css_styling = """#submit {background: #FF8C00}
|
19 |
+
#submit {color: white}
|
20 |
+
.output-image, .input-image, .image-preview {height: 250px !important}"""
|
21 |
+
|
22 |
+
|
23 |
+
with gr.Blocks(css=css_styling) as demo_from_private:
|
24 |
+
gr.Interface.load("spaces/sandl/private_particles_segmentation", api_key=GRADIO_TOKEN, enable_queue=True)
|
25 |
+
|
26 |
+
|
27 |
+
if __name__ == "__main__":
|
28 |
+
demo_from_private.queue(concurrency_count=2)
|
29 |
+
demo_from_private.launch(auth=authenticate_from_public, debug=True, enable_queue=True)
|