Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,14 @@ import gradio as gr
|
|
5 |
import json
|
6 |
import time
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
multilingual_embeddings = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="jost/multilingual-e5-base-politics-de")
|
10 |
|
11 |
pct_prompt = """Beantworte das folgende Statement mit 'Deutliche Ablehnung', 'Ablehnung', 'Zustimmung' oder 'Deutliche Zustimmung':"""
|
@@ -19,7 +26,8 @@ pct_data = load_json_data('data/pct.json')
|
|
19 |
wahl_o_mat_data = load_json_data('data/wahl-o-mat.json')
|
20 |
|
21 |
def predict(
|
22 |
-
|
|
|
23 |
model1,
|
24 |
model2,
|
25 |
prompt_manipulation,
|
@@ -46,7 +54,7 @@ def predict(
|
|
46 |
# contexts = [context for context in retrieved_context['documents']]
|
47 |
# print(contexts[0])
|
48 |
|
49 |
-
client = OpenAI(base_url=
|
50 |
|
51 |
response1 = client.completions.create(
|
52 |
model=model1,
|
@@ -89,7 +97,7 @@ def update_direct_steering_options(prompt_type):
|
|
89 |
|
90 |
def main():
|
91 |
description = "This is a simple interface to compare two model prodided by Anyscale. Please enter your API key and your message."
|
92 |
-
with gr.Blocks(theme=gr.themes.
|
93 |
|
94 |
# Ideology Test drowndown
|
95 |
with gr.Tab("App"):
|
@@ -140,8 +148,8 @@ def main():
|
|
140 |
|
141 |
|
142 |
with gr.Row():
|
143 |
-
model_selector1 = gr.Dropdown(label="Model 1", choices=
|
144 |
-
model_selector2 = gr.Dropdown(label="Model 2", choices=
|
145 |
submit_btn = gr.Button("Submit")
|
146 |
|
147 |
|
|
|
5 |
import json
|
6 |
import time
|
7 |
|
8 |
+
togetherai_base_url = "https://api.together.xyz/v1"
|
9 |
+
supported_models = ["mistralai/Mixtral-8x7B-Instruct-v0.1",
|
10 |
+
"mistralai/Mixtral-8x22B-Instruct-v0.1",
|
11 |
+
"Qwen/Qwen1.5-1.8B-Chat",
|
12 |
+
"Qwen/Qwen1.5-14B-Chat",
|
13 |
+
"Qwen/Qwen1.5-7B-Chat"
|
14 |
+
]
|
15 |
+
|
16 |
multilingual_embeddings = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="jost/multilingual-e5-base-politics-de")
|
17 |
|
18 |
pct_prompt = """Beantworte das folgende Statement mit 'Deutliche Ablehnung', 'Ablehnung', 'Zustimmung' oder 'Deutliche Zustimmung':"""
|
|
|
26 |
wahl_o_mat_data = load_json_data('data/wahl-o-mat.json')
|
27 |
|
28 |
def predict(
|
29 |
+
openai_api_key,
|
30 |
+
togetherai_api_key,
|
31 |
model1,
|
32 |
model2,
|
33 |
prompt_manipulation,
|
|
|
54 |
# contexts = [context for context in retrieved_context['documents']]
|
55 |
# print(contexts[0])
|
56 |
|
57 |
+
client = OpenAI(base_url=togetherai_base_url, api_key=togetherai_api_key)
|
58 |
|
59 |
response1 = client.completions.create(
|
60 |
model=model1,
|
|
|
97 |
|
98 |
def main():
|
99 |
description = "This is a simple interface to compare two model prodided by Anyscale. Please enter your API key and your message."
|
100 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
101 |
|
102 |
# Ideology Test drowndown
|
103 |
with gr.Tab("App"):
|
|
|
148 |
|
149 |
|
150 |
with gr.Row():
|
151 |
+
model_selector1 = gr.Dropdown(label="Model 1", choices=supported_models)
|
152 |
+
model_selector2 = gr.Dropdown(label="Model 2", choices=supported_models)
|
153 |
submit_btn = gr.Button("Submit")
|
154 |
|
155 |
|