Spaces:
Running
Running
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue Sep 17 15:03:39 2024 | |
@author: salikha4 | |
""" | |
import gradio as gr | |
import os | |
# Paths to the images folder (use relative paths) | |
RAW_PATH = "/images/raw" | |
EMBEDDINGS_PATH = "/images/embeddings" | |
# Function to display images based on user selection | |
def display_images(percentage, complexity): | |
# Format the filenames based on user selections | |
raw_image_path = f"{RAW_PATH}/percentage_{percentage}_complexity_{complexity}.png" | |
embeddings_image_path = f"{EMBEDDINGS_PATH}/percentage_{percentage}_complexity_{complexity}.png" | |
# Return the corresponding images for raw and embeddings | |
return raw_image_path, embeddings_image_path | |
# Define the Gradio interface | |
# Step 2: Pass arrays of values for data percentage and task complexity | |
data_percentage_options = [10, 30, 50, 70, 100] | |
task_complexity_options = [16, 32] | |
demo = gr.Interface( | |
fn=display_images, | |
inputs=[ | |
gr.Dropdown(data_percentage_options, label="Percentage of Data for Training"), # Dropdown for data percentage | |
gr.Radio(task_complexity_options, label="Task Complexity") # Radio for task complexity | |
], | |
outputs=[ | |
gr.Image(label="Raw Channels"), | |
gr.Image(label="Embeddings") | |
], | |
title="Raw vs. Embeddings Inference Results", | |
description="Select a data percentage and task complexity to view the corresponding inference result for raw channels and embeddings." | |
) | |
if __name__ == "__main__": | |
demo.launch() |