Spaces:
Sleeping
Sleeping
Update app.py
Browse files8 unmodified lines91011121314151617181920212223242526272829303132333435153 unmodified lines18919019119219319419556 unmodified lines2522532542552562572588 unmodified linesmarkdown_content = """## PoliticalLLMThis 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.### How to Use:1. **Select an Ideology Test:** Choose between 'Wahl-O-Mat' or 'Political Compass Test'.2. **Select or Enter a Political Statement:** Choose a statement or enter your own.3. **Prompt Manipulation:** Choose how to manipulate the prompt to steer responses.4. **Select Models:** Choose two models to generate responses.5. **Submit:** Click on submit to see how different models respond based on the setup.**Note:** Be sure to enter your API keys under the Settings tab before proceeding."""DESCRIPTION = '''<div><h1 style="text-align: center;">Meta Llama3 8B</h1><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><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><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></div>'''css = """h1 {153 unmodified linesgr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")# Ideology Test dropdownwith gr.Tab("App"):with gr.Row():ideology_test = gr.Dropdown(scale=1,56 unmodified lineswith gr.Accordion("Prompt details", open=False):prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")with gr.Tab("Settings"):with gr.Row():openai_api_key = gr.Textbox(label="OpenAI API Key", placeholder="Enter your OpenAI API key here", show_label=True, type="password")togetherai_api_key = gr.Textbox(label="Together.ai API Key", placeholder="Enter your Together.ai API key here", show_label=True, type="password")8 unmodified lines9101112131415161718192021222324252627153 unmodified lines18118218318418518618756 unmodified lines2442452462472482492508 unmodified linesmarkdown_content = """## PoliticalLLMThis 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.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).### How to Use:1. **Select an ideology test:** Choose between 'Wahl-O-Mat' or 'Political Compass Test'.2. **Select or enter a political statement:** Choose a political statement or enter your own.3. **Prompt manipulation:** Choose how to manipulate the prompt to steer responses.4. **Select models:** Choose up to two models to generate responses.5. **Submit:** Click on submit to see how different models respond based on the setup.**Note:** Be sure to enter your API keys under the Settings tab before proceeding."""css = """h1 {153 unmodified linesgr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")# Ideology Test dropdownwith gr.Tab("🤖 App"):with gr.Row():ideology_test = gr.Dropdown(scale=1,56 unmodified lineswith gr.Accordion("Prompt details", open=False):prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")with gr.Tab("⚙️ Settings"):with gr.Row():openai_api_key = gr.Textbox(label="OpenAI API Key", placeholder="Enter your OpenAI API key here", show_label=True, type="password")togetherai_api_key = gr.Textbox(label="Together.ai API Key", placeholder="Enter your Together.ai API key here", show_label=True, type="password")
app.py+8-16