Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,27 +9,19 @@ import random
|
|
9 |
markdown_content = """
|
10 |
## PoliticalLLM
|
11 |
|
12 |
-
This application
|
|
|
13 |
|
14 |
### How to Use:
|
15 |
-
1. **Select an
|
16 |
-
2. **Select or
|
17 |
-
3. **Prompt
|
18 |
-
4. **Select
|
19 |
5. **Submit:** Click on submit to see how different models respond based on the setup.
|
20 |
|
21 |
**Note:** Be sure to enter your API keys under the Settings tab before proceeding.
|
22 |
"""
|
23 |
|
24 |
-
DESCRIPTION = '''
|
25 |
-
<div>
|
26 |
-
<h1 style="text-align: center;">Meta Llama3 8B</h1>
|
27 |
-
<p>This Space demonstrates the instruction-tuned model <a href="https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct"><b>Meta Llama3 8b Chat</b></a>. Meta Llama3 is the new open LLM and comes in two sizes: 8b and 70b. Feel free to play with it, or duplicate to run privately!</p>
|
28 |
-
<p>🔎 For more details about the Llama3 release and how to use the model with <code>transformers</code>, take a look <a href="https://huggingface.co/blog/llama3">at our blog post</a>.</p>
|
29 |
-
<p>🦕 Looking for an even more powerful model? Check out the <a href="https://huggingface.co/chat/"><b>Hugging Chat</b></a> integration for Meta Llama 3 70b</p>
|
30 |
-
</div>
|
31 |
-
'''
|
32 |
-
|
33 |
|
34 |
css = """
|
35 |
h1 {
|
@@ -189,7 +181,7 @@ def main():
|
|
189 |
gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
|
190 |
|
191 |
# Ideology Test dropdown
|
192 |
-
with gr.Tab("App"):
|
193 |
with gr.Row():
|
194 |
ideology_test = gr.Dropdown(
|
195 |
scale=1,
|
@@ -252,7 +244,7 @@ def main():
|
|
252 |
with gr.Accordion("Prompt details", open=False):
|
253 |
prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")
|
254 |
|
255 |
-
with gr.Tab("Settings"):
|
256 |
with gr.Row():
|
257 |
openai_api_key = gr.Textbox(label="OpenAI API Key", placeholder="Enter your OpenAI API key here", show_label=True, type="password")
|
258 |
togetherai_api_key = gr.Textbox(label="Together.ai API Key", placeholder="Enter your Together.ai API key here", show_label=True, type="password")
|
|
|
9 |
markdown_content = """
|
10 |
## PoliticalLLM
|
11 |
|
12 |
+
This application showcases how LLMs respond to statements from two tests ideology tests, Wahl-O-Mat and Political Compass Test. Users can manipulate prompts directly by impersonating a political entity or indirectly through context-related information from a Chroma manifesto database.
|
13 |
+
This demo is based on the master's thesis _“Steering Large Language Models towards Political Ideologies on Prompt-Level”_. Full framework is available at: [Link text](https://github.com/j0st/PoliticalLLM).
|
14 |
|
15 |
### How to Use:
|
16 |
+
1. **Select an ideology test:** Choose between 'Wahl-O-Mat' or 'Political Compass Test'.
|
17 |
+
2. **Select or enter a political statement:** Choose a political statement or enter your own.
|
18 |
+
3. **Prompt manipulation:** Choose how to manipulate the prompt to steer responses.
|
19 |
+
4. **Select models:** Choose up to two models to generate responses.
|
20 |
5. **Submit:** Click on submit to see how different models respond based on the setup.
|
21 |
|
22 |
**Note:** Be sure to enter your API keys under the Settings tab before proceeding.
|
23 |
"""
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
css = """
|
27 |
h1 {
|
|
|
181 |
gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
|
182 |
|
183 |
# Ideology Test dropdown
|
184 |
+
with gr.Tab("🤖 App"):
|
185 |
with gr.Row():
|
186 |
ideology_test = gr.Dropdown(
|
187 |
scale=1,
|
|
|
244 |
with gr.Accordion("Prompt details", open=False):
|
245 |
prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")
|
246 |
|
247 |
+
with gr.Tab("⚙️ Settings"):
|
248 |
with gr.Row():
|
249 |
openai_api_key = gr.Textbox(label="OpenAI API Key", placeholder="Enter your OpenAI API key here", show_label=True, type="password")
|
250 |
togetherai_api_key = gr.Textbox(label="Together.ai API Key", placeholder="Enter your Together.ai API key here", show_label=True, type="password")
|