File size: 2,622 Bytes
e8e247e
abba6e8
 
 
 
081b46f
7d35e7d
814e7e2
abba6e8
 
 
e9ec0aa
abba6e8
 
 
 
e9ec0aa
 
 
956b24f
6f1af31
abba6e8
 
 
7d35e7d
 
abba6e8
7d35e7d
7b8870b
abba6e8
 
7d35e7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import gradio as gr
from transformers import pipeline

# Initialize the GPT-2 pipeline
pipe = pipeline("text-generation", model="gpt2")

theme = gr.themes.Soft()

# Function that generates text based on instruction-based prompting
def generate_text(input_instruction):
    # Use the input instruction to generate text
    generated_text = pipe(input_instruction, max_length=500)[0]['generated_text']
    return generated_text

# Define example instructions for testing
instruction_examples = [
    ("Describe the origin of the universe"),
    ("Explain the concept of artificial intelligence"),
    ("Describe the most common types of cancer"),
]

# Function that echoes the input text
#def echo_text(input_text):
#    return input_text

with gr.Interface(
    fn=generate_text,
    inputs=gr.Textbox(placeholder="Enter text here..."),
    outputs=gr.Textbox(),
    examples=instruction_examples, 
    live=False,
    title="LLM Evaluator with Linguistic Scrutiny",
    theme=theme
) as iface:
    blocks = gr.Blocks()
    
    with gr.Row():
        vicuna_model_selector = gr.Dropdown(["7b", "13b", "33b"], label="Vicuna Model", placeholder="Select model size")
        llama_model_selector = gr.Dropdown(["7B", "13B", "30B", "65B"], label="LLaMa Model", placeholder="Select model size")
        chatgpt_api_key = gr.Textbox(label="ChatGPT API Key", type="password", placeholder="Enter your API key")

    # Strategy 1 - QA-Based Prompting
    with gr.Accordion("Strategy 1 - QA-Based Prompting", style="font-weight: bold; font-size: 16px;"):
        with gr.Row():
            chatgpt_btn = gr.Button("ChatGPT")
            llama_btn = gr.Button("LLaMA")
            vicuna_btn = gr.Button("Vicuna")
            alpaca_btn = gr.Button("Alpaca")
            flant5_btn = gr.Button("Flan-T5")

    # Strategy 2 - Instruction-Based Prompting
    with gr.Accordion("Strategy 2 - Instruction-Based Prompting", style="font-weight: bold; font-size: 16px;"):
        with gr.Row():
            chatgpt_btn = gr.Button("ChatGPT")
            llama_btn = gr.Button("LLaMA")
            vicuna_btn = gr.Button("Vicuna")
            alpaca_btn = gr.Button("Alpaca")
            flant5_btn = gr.Button("Flan-T5")

    # Strategy 3 - Structured Prompting
    with gr.Accordion("Strategy 3 - Structured Prompting", style="font-weight: bold; font-size: 16px;"):
        with gr.Row():
            chatgpt_btn = gr.Button("ChatGPT")
            llama_btn = gr.Button("LLaMA")
            vicuna_btn = gr.Button("Vicuna")
            alpaca_btn = gr.Button("Alpaca")
            flant5_btn = gr.Button("Flan-T5")
    
    iface.launch()