Commit ·
ce7a6b4
1
Parent(s): 8c1ae73
change background
Browse files- __pycache__/context.cpython-310.pyc +0 -0
- app.py +57 -1
__pycache__/context.cpython-310.pyc
ADDED
|
Binary file (1.73 kB). View file
|
|
|
app.py
CHANGED
|
@@ -3,7 +3,10 @@ import csv
|
|
| 3 |
import json
|
| 4 |
from datetime import datetime
|
| 5 |
import gradio as gr
|
|
|
|
|
|
|
| 6 |
import openai
|
|
|
|
| 7 |
from context import system_prompt
|
| 8 |
openai.api_key = "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"
|
| 9 |
# openai.api_key = os.getenv('OPENAI_API_KEY')
|
|
@@ -26,6 +29,59 @@ status_msgs = dict(
|
|
| 26 |
cleared="Status: Conversation Cleared. Waiting"
|
| 27 |
)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
def make_dir():
|
| 31 |
"""Build directory for storing chat logs and update session_vars['path_filename']."""
|
|
@@ -137,7 +193,7 @@ with open("custom.css", "r", encoding="utf-8") as f:
|
|
| 137 |
|
| 138 |
# TODO: how to do about launching unique sessions and logging chats without interference?
|
| 139 |
# Gradio App
|
| 140 |
-
with gr.Blocks(css=customCSS) as demo:
|
| 141 |
# SETUP
|
| 142 |
# Session variables
|
| 143 |
session_vars = dict(
|
|
|
|
| 3 |
import json
|
| 4 |
from datetime import datetime
|
| 5 |
import gradio as gr
|
| 6 |
+
from gradio.themes.base import Base
|
| 7 |
+
from gradio.themes.utils import colors, fonts, sizes
|
| 8 |
import openai
|
| 9 |
+
from typing import Iterable
|
| 10 |
from context import system_prompt
|
| 11 |
openai.api_key = "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"
|
| 12 |
# openai.api_key = os.getenv('OPENAI_API_KEY')
|
|
|
|
| 29 |
cleared="Status: Conversation Cleared. Waiting"
|
| 30 |
)
|
| 31 |
|
| 32 |
+
class Seafoam(Base):
|
| 33 |
+
def __init__(
|
| 34 |
+
self,
|
| 35 |
+
*,
|
| 36 |
+
primary_hue: colors.Color | str = colors.emerald,
|
| 37 |
+
secondary_hue: colors.Color | str = colors.blue,
|
| 38 |
+
neutral_hue: colors.Color | str = colors.blue,
|
| 39 |
+
spacing_size: sizes.Size | str = sizes.spacing_md,
|
| 40 |
+
radius_size: sizes.Size | str = sizes.radius_md,
|
| 41 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
| 42 |
+
font: fonts.Font
|
| 43 |
+
| str
|
| 44 |
+
| Iterable[fonts.Font | str] = (
|
| 45 |
+
fonts.GoogleFont("Quicksand"),
|
| 46 |
+
"ui-sans-serif",
|
| 47 |
+
"sans-serif",
|
| 48 |
+
),
|
| 49 |
+
font_mono: fonts.Font
|
| 50 |
+
| str
|
| 51 |
+
| Iterable[fonts.Font | str] = (
|
| 52 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
| 53 |
+
"ui-monospace",
|
| 54 |
+
"monospace",
|
| 55 |
+
),
|
| 56 |
+
):
|
| 57 |
+
super().__init__(
|
| 58 |
+
primary_hue=primary_hue,
|
| 59 |
+
secondary_hue=secondary_hue,
|
| 60 |
+
neutral_hue=neutral_hue,
|
| 61 |
+
spacing_size=spacing_size,
|
| 62 |
+
radius_size=radius_size,
|
| 63 |
+
text_size=text_size,
|
| 64 |
+
font=font,
|
| 65 |
+
font_mono=font_mono,
|
| 66 |
+
)
|
| 67 |
+
super().set(
|
| 68 |
+
body_background_fill="repeating-linear-gradient(45deg, *primary_200, *primary_200 10px, *primary_50 10px, *primary_50 20px)",
|
| 69 |
+
body_background_fill_dark="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
|
| 70 |
+
button_primary_background_fill="linear-gradient(90deg, *primary_300, *secondary_400)",
|
| 71 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *primary_200, *secondary_300)",
|
| 72 |
+
button_primary_text_color="white",
|
| 73 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *primary_600, *secondary_800)",
|
| 74 |
+
slider_color="*secondary_300",
|
| 75 |
+
slider_color_dark="*secondary_600",
|
| 76 |
+
block_title_text_weight="600",
|
| 77 |
+
block_border_width="3px",
|
| 78 |
+
block_shadow="*shadow_drop_lg",
|
| 79 |
+
button_shadow="*shadow_drop_lg",
|
| 80 |
+
button_large_padding="32px",
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
seafoam = Seafoam()
|
| 85 |
|
| 86 |
def make_dir():
|
| 87 |
"""Build directory for storing chat logs and update session_vars['path_filename']."""
|
|
|
|
| 193 |
|
| 194 |
# TODO: how to do about launching unique sessions and logging chats without interference?
|
| 195 |
# Gradio App
|
| 196 |
+
with gr.Blocks(theme=seafoam, css=customCSS) as demo:
|
| 197 |
# SETUP
|
| 198 |
# Session variables
|
| 199 |
session_vars = dict(
|