Spaces:
Runtime error
Runtime error
Dagfinn1962
commited on
Commit
•
7c2b33c
1
Parent(s):
9077225
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,17 @@ import logging
|
|
4 |
import gradio as gr
|
5 |
import os
|
6 |
from src.llm_boilers import llm_boiler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)
|
@@ -134,9 +145,9 @@ with gr.Blocks(theme='HaleyCH/HaleyCH_Theme') as demo:
|
|
134 |
# to do: change to openaikey input for public release
|
135 |
openai_key = gr.Textbox(
|
136 |
label="OpenAI Key",
|
137 |
-
value="",
|
138 |
type="password",
|
139 |
-
placeholder="
|
140 |
info="You have to provide your own OpenAI API key.",
|
141 |
)
|
142 |
|
|
|
4 |
import gradio as gr
|
5 |
import os
|
6 |
from src.llm_boilers import llm_boiler
|
7 |
+
import configparser
|
8 |
+
|
9 |
+
# Read the configuration file
|
10 |
+
config = configparser.ConfigParser()
|
11 |
+
config.read('config.ini')
|
12 |
+
|
13 |
+
# Get the OpenAI key from the configuration file
|
14 |
+
openai_key = config.get('Credentials', 'openai_key')
|
15 |
+
|
16 |
+
# Use openai_key in your code
|
17 |
+
|
18 |
|
19 |
|
20 |
logging.basicConfig(format="%(asctime)s - %(message)s", level=logging.INFO)
|
|
|
145 |
# to do: change to openaikey input for public release
|
146 |
openai_key = gr.Textbox(
|
147 |
label="OpenAI Key",
|
148 |
+
value="openai_key",
|
149 |
type="password",
|
150 |
+
placeholder="openai_key",
|
151 |
info="You have to provide your own OpenAI API key.",
|
152 |
)
|
153 |
|