Yeyito's picture
Modulized subprocess
d649c17
raw
history blame
850 Bytes
import gradio as gr
import subprocess
import os
import sys
# Add the path to the "src" directory of detect-pretrain-code-contamination to the sys.path
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "detect-pretrain-code-contamination"))
src_dir = os.path.join(project_root, "src")
sys.path.insert(0, src_dir)
import run as evaluator # Import the run module
def evaluate(model):
return evaluator.main(
target_model="roneneldan/TinyStories-1M",
ref_model="roneneldan/TinyStories-Instruct-1M",
output_dir="out",
data="truthful_qa",
length=64,
key_name="input",
ratio_gen=0.4
) # Call the run_main function directly
iface = gr.Interface(fn=evaluate, inputs="text", outputs="text")
iface.launch()