Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,45 @@ import json
|
|
6 |
import time
|
7 |
import random
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
togetherai_base_url = "https://api.together.xyz/v1"
|
10 |
|
11 |
supported_models = ["mistralai/Mixtral-8x7B-Instruct-v0.1",
|
@@ -146,7 +185,10 @@ def main():
|
|
146 |
|
147 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
148 |
|
149 |
-
|
|
|
|
|
|
|
150 |
with gr.Tab("App"):
|
151 |
with gr.Row():
|
152 |
ideology_test = gr.Dropdown(
|
|
|
6 |
import time
|
7 |
import random
|
8 |
|
9 |
+
markdown_content = """
|
10 |
+
## PoliticalLLM
|
11 |
+
|
12 |
+
This application leverages advanced AI models to predict responses to political statements based on various ideological tests such as Wahl-O-Mat and Political Compass Test. Users can manipulate prompts directly by impersonating a political entity or indirectly through context-related information from our manifesto database.
|
13 |
+
|
14 |
+
### How to Use:
|
15 |
+
1. **Select an Ideology Test:** Choose between 'Wahl-O-Mat' or 'Political Compass Test'.
|
16 |
+
2. **Select or Enter a Political Statement:** Choose a statement or enter your own.
|
17 |
+
3. **Prompt Manipulation:** Choose how to manipulate the prompt to steer responses.
|
18 |
+
4. **Select Models:** Choose two models to generate responses.
|
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 {
|
36 |
+
text-align: center;
|
37 |
+
display: block;
|
38 |
+
}
|
39 |
+
#duplicate-button {
|
40 |
+
margin: auto;
|
41 |
+
color: white;
|
42 |
+
background: #1565c0;
|
43 |
+
border-radius: 100vh;
|
44 |
+
}
|
45 |
+
"""
|
46 |
+
|
47 |
+
|
48 |
togetherai_base_url = "https://api.together.xyz/v1"
|
49 |
|
50 |
supported_models = ["mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
|
185 |
|
186 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
187 |
|
188 |
+
gr.Markdown(markdown_content)
|
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(
|