Spaces:
Runtime error
Runtime error
File size: 2,423 Bytes
c9207fd bf00256 c9207fd 0675903 c9207fd bf00256 c9207fd b62c95a c9207fd b62c95a 3eb615a b62c95a c9207fd |
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
import gradio as gr
import os
from spaces_utils import authenticate
# Load tokens
GRADIO_TOKEN = os.environ.get("READ_TOKEN") # read
# Logs repo path
dataset_url = "https://huggingface.co/datasets/sandl/upload_particles_segmentation"
dataset_path = "logs_particles_segmentation.csv"
def authenticate_from_public(username, password):
return authenticate(username, password, dataset_url, dataset_path)
css_styling = """#submit {background: #1eccd8}
#submit {color: white}
.output-image, .input-image, .image-preview {height: 250px !important}"""
new_blue_color = gr.themes.Color(c50="#FF00FF", # Dataframe background cell content - light mode only
c100="#0c1538", # Text of markdown (headers) and componnet contencts
c200="#000000", # Text of component headers
c300="#a1c6db", # Login button when used in primary color
c400="#000000", # Text of "or" objects and footer
c500="#000000", # Text of component headers in light mode only
c600="#e4f3fa", # Clear button (gradient between c600 and c700 + mouse over)
c700="#a1c6db", # Componennt borders
c800="#e4f3fa", # Background of components
c900="#a1c6db", # Etiquette of components
c950="#FFFFFF") # Background
# secondary color used for highlight box content when typing in light mode, and download option in dark mode
# primary color used for login button in dark mode
osium_theme = gr.themes.Default(primary_hue="cyan", secondary_hue="cyan", neutral_hue=new_blue_color)
page_title = "Nanoparticles characterization"
favicon_path = "osiumai_favicon.ico"
logo_path = "osiumai_logo.jpg"
html = f"""<html> <link rel="icon" type="image/x-icon" href="file={favicon_path}">
<img src='file={logo_path}' alt='Osium AI logo' width='200' height='100'> </html>"""
with gr.Blocks(css=css_styling, theme=osium_theme, title=page_title) as demo_from_private:
gr.Interface.load("spaces/sandl/private_particles_segmentation", api_key=GRADIO_TOKEN, enable_queue=True)
if __name__ == "__main__":
demo_from_private.queue(concurrency_count=2)
demo_from_private.launch(auth=authenticate_from_public, debug=True, enable_queue=True) |