Spaces:
Runtime error
Runtime error
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:hover {background: #a2f1f6} | |
.output-image, .input-image, .image-preview {height: 250px !important} | |
.output-plot {height: 250px !important}""" | |
light_theme_colors = gr.themes.Color(c50="#e4f3fa", # Dataframe background cell content - light mode only | |
c100="#e4f3fa", # Top corner of clear button in light mode + markdown text in dark mode | |
c200="#a1c6db", # Component borders | |
c300="#FFFFFF", # | |
c400="#e4f3fa", # Footer text | |
c500="#0c1538", # Text of component headers in light mode only | |
c600="#a1c6db", # Top corner of button in dark mode | |
c700="#475383", # Button text in light mode + component borders in dark mode | |
c800="#0c1538", # Markdown text in light mode | |
c900="#a1c6db", # Background of dataframe - dark mode | |
c950="#0c1538") # Background in dark mode only | |
# 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=light_theme_colors) | |
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, show_progress=True) 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(debug=True, enable_queue=True) |