File size: 855 Bytes
e8e247e
081b46f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98e913c
 
081b46f
 
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
import gradio as gr
import subprocess
from gradio.mix import Parallel

def qa_prompting(model):
    # Call your `run_llm.py` script for QA-Based Prompting with the selected model
    output = subprocess.check_output([sys.executable, "run_llm.py", "--model", model, ...], text=True)
    return output

def strategy_1_interface():
    model_names = ["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"]
    interfaces = []
    for model_name in model_names:
        interfaces.append(gr.Interface(
            fn=qa_prompting,
            inputs=gr.inputs.Textbox(label=f"{model_name} Input"),
            outputs=gr.outputs.Textbox(label=f"{model_name} Output"),
            title=f"Strategy 1 - QA-Based Prompting: {model_name}",
        ))

    return Parallel(*interfaces)

if __name__ == "__main__":
    iface = strategy_1_interface()
    iface.launch()