Spaces:
Running
Running
RobertoBarrosoLuque
commited on
Commit
·
0d006a9
1
Parent(s):
cf961a5
No need for external k
Browse files- src/app.py +2 -13
src/app.py
CHANGED
|
@@ -12,6 +12,7 @@ load_dotenv()
|
|
| 12 |
_FILE_PATH = Path(__file__).parents[1]
|
| 13 |
FOMC_MEETINGS = load_processed_meetings()
|
| 14 |
PROMPT_LIBRARY = load_prompt_library()
|
|
|
|
| 15 |
|
| 16 |
def convert_history_to_string(history: list) -> str:
|
| 17 |
previous_messages = ""
|
|
@@ -20,7 +21,7 @@ def convert_history_to_string(history: list) -> str:
|
|
| 20 |
return previous_messages
|
| 21 |
|
| 22 |
|
| 23 |
-
def respond_for_chat_interface(message: str, history: list, api_key_input: str =
|
| 24 |
"""Enhanced response function for gr.ChatInterface with Fed AI Savant capabilities"""
|
| 25 |
|
| 26 |
api_key = api_key_input.strip() if api_key_input else os.getenv("FIREWORKS_API_KEY", "")
|
|
@@ -165,17 +166,6 @@ with gr.Blocks(css=CUSTOM_CSS, title="Fed AI Savant", theme=GRADIO_THEME) as dem
|
|
| 165 |
show_fullscreen_button=False,
|
| 166 |
show_share_button=False,
|
| 167 |
)
|
| 168 |
-
with gr.Column(scale=2):
|
| 169 |
-
val = os.getenv("FIREWORKS_API_KEY", "")
|
| 170 |
-
api_key_value = gr.Textbox(
|
| 171 |
-
label="API Key",
|
| 172 |
-
type="password",
|
| 173 |
-
placeholder="Enter your Fireworks AI API key",
|
| 174 |
-
value=val,
|
| 175 |
-
container=True,
|
| 176 |
-
elem_classes="compact-input"
|
| 177 |
-
)
|
| 178 |
-
|
| 179 |
# Example Questions - compact version
|
| 180 |
with gr.Row(elem_classes="compact-examples"):
|
| 181 |
example_1 = gr.Button(EXAMPLE_QUESTIONS[0], size="sm", scale=1)
|
|
@@ -191,7 +181,6 @@ with gr.Blocks(css=CUSTOM_CSS, title="Fed AI Savant", theme=GRADIO_THEME) as dem
|
|
| 191 |
textbox=gr.Textbox(
|
| 192 |
placeholder="Ask about Fed policy, rate decisions, or FOMC meetings...", scale=10
|
| 193 |
),
|
| 194 |
-
additional_inputs=[api_key_value],
|
| 195 |
cache_examples=False,
|
| 196 |
submit_btn="Send"
|
| 197 |
)
|
|
|
|
| 12 |
_FILE_PATH = Path(__file__).parents[1]
|
| 13 |
FOMC_MEETINGS = load_processed_meetings()
|
| 14 |
PROMPT_LIBRARY = load_prompt_library()
|
| 15 |
+
API_KEY = os.getenv("FIREWORKS_API_KEY")
|
| 16 |
|
| 17 |
def convert_history_to_string(history: list) -> str:
|
| 18 |
previous_messages = ""
|
|
|
|
| 21 |
return previous_messages
|
| 22 |
|
| 23 |
|
| 24 |
+
def respond_for_chat_interface(message: str, history: list, api_key_input: str = None):
|
| 25 |
"""Enhanced response function for gr.ChatInterface with Fed AI Savant capabilities"""
|
| 26 |
|
| 27 |
api_key = api_key_input.strip() if api_key_input else os.getenv("FIREWORKS_API_KEY", "")
|
|
|
|
| 166 |
show_fullscreen_button=False,
|
| 167 |
show_share_button=False,
|
| 168 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
# Example Questions - compact version
|
| 170 |
with gr.Row(elem_classes="compact-examples"):
|
| 171 |
example_1 = gr.Button(EXAMPLE_QUESTIONS[0], size="sm", scale=1)
|
|
|
|
| 181 |
textbox=gr.Textbox(
|
| 182 |
placeholder="Ask about Fed policy, rate decisions, or FOMC meetings...", scale=10
|
| 183 |
),
|
|
|
|
| 184 |
cache_examples=False,
|
| 185 |
submit_btn="Send"
|
| 186 |
)
|