Florian Leuerer commited on
Commit
9631045
1 Parent(s): faefd91
Files changed (3) hide show
  1. app.py +40 -0
  2. data.csv +0 -0
  3. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import random
4
+
5
+ df = pd.read_csv('data.csv')
6
+
7
+
8
+ models = df.columns.tolist()
9
+ print(models)
10
+ models.remove('hash')
11
+ models.remove('message')
12
+ messages = sorted(df['message'].tolist(), key=len)
13
+ messages_select = [(m[:150],m) for m in messages]
14
+
15
+ def out(message, model1, model2):
16
+ row = df[df['message'] == message]
17
+ output1 = row[model1].values[0]
18
+ output2 = row[model2].values[0]
19
+ return message, output1, output2
20
+
21
+
22
+ with gr.Blocks() as iface:
23
+ with gr.Row():
24
+ drop_message = gr.Dropdown(messages_select, label='Prompt', value=random.choice(messages))
25
+ with gr.Row():
26
+ drop_model1 = gr.Dropdown(models, label='Model 1', value=random.choice(models))
27
+ drop_model2 = gr.Dropdown(models, label='Model 2', value=random.choice(models))
28
+ with gr.Row():
29
+ btn = gr.Button("Run")
30
+ with gr.Row():
31
+ out_message = gr.TextArea(label='Prompt')
32
+ with gr.Row():
33
+ out_model1 = gr.TextArea(label='Output Model 1')
34
+ out_model2 = gr.TextArea(label='Output Model 2')
35
+
36
+ btn.click(out,
37
+ inputs=[drop_message, drop_model1, drop_model2],
38
+ outputs=[out_message, out_model1, out_model2])
39
+
40
+ iface.launch()
data.csv ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
File without changes