import gradio as gr import spaces # TOKENIZER = # MINIMUM_TOKENS = 64 # def count_tokens(text): # return len(TOKENIZER(text).input_ids) # Mock function for testing layout def run_test_power(model_name, real_text, generated_text, N=10): return f"Prediction: Human (Mocked for {model_name})" # Change mode name #def change_mode(mode): # if mode == "Faster Model": # .change_mode("t5-small") # elif mode == "Medium Model": # .change_mode("roberta-base-openai-detector") # elif mode == "Powerful Model": # .change_mode("falcon-rw-1b") # else: # gr.Error(f"Invaild mode selected.") # return mode css = """ #header { text-align: center; font-size: 1.5em; margin-bottom: 20px; } #output-text { font-weight: bold; font-size: 1.2em; } .links { display: flex; justify-content: flex-end; gap: 10px; margin-right: 10px; align-items: center; } .separator { margin: 0 5px; color: black; } .row { display: flex; justify-content: center; width: 100%; } .gradio-row input, .gradio-row select { width: 250px; /* Set all elements to the same width */ margin: 5px; } /* Adjusting layout for Input Text and Inference Result */ .input-row { display: flex; width: 100%; } .input-text { flex: 3; /* 4 parts of the row */ margin-right: 1px; } .output-text { flex: 1; /* 1 part of the row */ } /* Set button widths to match the Select Model width */ .button { width: 250px; /* Same as the select box width */ Height: 100px; } """ # Gradio App with gr.Blocks(css=css) as app: with gr.Row(): gr.HTML('