Commit
·
6d546ef
1
Parent(s):
7a8e9d9
fix streamlit layout
Browse files
1_Auto_Generate_Prompts.py
CHANGED
|
@@ -13,6 +13,9 @@ from transformers import AutoTokenizer, AutoModelForCausalLM, TextIteratorStream
|
|
| 13 |
from peft import PeftModel
|
| 14 |
from huggingface_hub import login, whoami
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
scroll_css = """
|
| 17 |
<style>
|
| 18 |
.table-scroll {
|
|
@@ -24,7 +27,6 @@ scroll_css = """
|
|
| 24 |
"""
|
| 25 |
st.markdown(scroll_css, unsafe_allow_html=True)
|
| 26 |
|
| 27 |
-
st.set_page_config(layout="wide")
|
| 28 |
st.title("Auto Red Teaming Demo for HI")
|
| 29 |
st.markdown(
|
| 30 |
"""
|
|
|
|
| 13 |
from peft import PeftModel
|
| 14 |
from huggingface_hub import login, whoami
|
| 15 |
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
st.set_page_config(layout="wide")
|
| 19 |
scroll_css = """
|
| 20 |
<style>
|
| 21 |
.table-scroll {
|
|
|
|
| 27 |
"""
|
| 28 |
st.markdown(scroll_css, unsafe_allow_html=True)
|
| 29 |
|
|
|
|
| 30 |
st.title("Auto Red Teaming Demo for HI")
|
| 31 |
st.markdown(
|
| 32 |
"""
|
pages/2_Select_Best_Prompts.py
CHANGED
|
@@ -7,6 +7,9 @@ from openai import OpenAI
|
|
| 7 |
from pydantic import BaseModel
|
| 8 |
from typing import List
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
scroll_css = """
|
| 11 |
<style>
|
| 12 |
.table-scroll {
|
|
@@ -18,7 +21,6 @@ scroll_css = """
|
|
| 18 |
"""
|
| 19 |
st.markdown(scroll_css, unsafe_allow_html=True)
|
| 20 |
|
| 21 |
-
st.set_page_config(layout="wide")
|
| 22 |
st.title("Select Best Prompts")
|
| 23 |
|
| 24 |
def extract_json_content(markdown_str: str) -> str:
|
|
|
|
| 7 |
from pydantic import BaseModel
|
| 8 |
from typing import List
|
| 9 |
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
st.set_page_config(layout="wide")
|
| 13 |
scroll_css = """
|
| 14 |
<style>
|
| 15 |
.table-scroll {
|
|
|
|
| 21 |
"""
|
| 22 |
st.markdown(scroll_css, unsafe_allow_html=True)
|
| 23 |
|
|
|
|
| 24 |
st.title("Select Best Prompts")
|
| 25 |
|
| 26 |
def extract_json_content(markdown_str: str) -> str:
|
pages/3_Client_Response.py
CHANGED
|
@@ -5,6 +5,8 @@ import streamlit as st
|
|
| 5 |
import pandas as pd
|
| 6 |
from openai import OpenAI
|
| 7 |
|
|
|
|
|
|
|
| 8 |
scroll_css = """
|
| 9 |
<style>
|
| 10 |
.table-scroll {
|
|
@@ -16,7 +18,7 @@ scroll_css = """
|
|
| 16 |
"""
|
| 17 |
|
| 18 |
st.markdown(scroll_css, unsafe_allow_html=True)
|
| 19 |
-
|
| 20 |
st.title("Client Response (Answering)")
|
| 21 |
|
| 22 |
# Use best_samples if available; otherwise, fallback to the interactive single sample.
|
|
@@ -74,7 +76,7 @@ if st.button("Generate responses with Client Application"):
|
|
| 74 |
st.markdown("<div class='table-scroll'>", unsafe_allow_html=True)
|
| 75 |
st.table(df_answered_styled)
|
| 76 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 77 |
-
|
| 78 |
st.session_state.refined_samples = answered_samples
|
| 79 |
else:
|
| 80 |
st.error("Please provide your Client API Key.")
|
|
|
|
| 5 |
import pandas as pd
|
| 6 |
from openai import OpenAI
|
| 7 |
|
| 8 |
+
|
| 9 |
+
st.set_page_config(layout="wide")
|
| 10 |
scroll_css = """
|
| 11 |
<style>
|
| 12 |
.table-scroll {
|
|
|
|
| 18 |
"""
|
| 19 |
|
| 20 |
st.markdown(scroll_css, unsafe_allow_html=True)
|
| 21 |
+
|
| 22 |
st.title("Client Response (Answering)")
|
| 23 |
|
| 24 |
# Use best_samples if available; otherwise, fallback to the interactive single sample.
|
|
|
|
| 76 |
st.markdown("<div class='table-scroll'>", unsafe_allow_html=True)
|
| 77 |
st.table(df_answered_styled)
|
| 78 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 79 |
+
|
| 80 |
st.session_state.refined_samples = answered_samples
|
| 81 |
else:
|
| 82 |
st.error("Please provide your Client API Key.")
|