Spaces:
Build error
Build error
Commit
Β·
1e727da
1
Parent(s):
b90e510
Update app.py
Browse files
app.py
CHANGED
@@ -137,6 +137,7 @@ with gr.Blocks() as demo:
|
|
137 |
with gr.Tab("Instructor Only"):
|
138 |
# API Authentication functionality
|
139 |
# Instead of ask students to provide key, the key is now provided by the instructor
|
|
|
140 |
with gr.Box():
|
141 |
gr.Markdown("### OpenAI API Key ")
|
142 |
gr.HTML("""<span>Embed your OpenAI API key below; if you haven't created one already, visit
|
@@ -147,14 +148,15 @@ with gr.Blocks() as demo:
|
|
147 |
placeholder="βββββββββββββββββ", value='')
|
148 |
api_input.submit(fn=embed_key, inputs=[api_input, study_tutor], outputs=study_tutor)
|
149 |
api_input.blur(fn=embed_key, inputs=[api_input, study_tutor], outputs=study_tutor)
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
158 |
|
159 |
# Upload secret prompt functionality
|
160 |
# The instructor will provide a secret prompt/persona to the tutor
|
|
|
137 |
with gr.Tab("Instructor Only"):
|
138 |
# API Authentication functionality
|
139 |
# Instead of ask students to provide key, the key is now provided by the instructor
|
140 |
+
"""
|
141 |
with gr.Box():
|
142 |
gr.Markdown("### OpenAI API Key ")
|
143 |
gr.HTML("""<span>Embed your OpenAI API key below; if you haven't created one already, visit
|
|
|
148 |
placeholder="βββββββββββββββββ", value='')
|
149 |
api_input.submit(fn=embed_key, inputs=[api_input, study_tutor], outputs=study_tutor)
|
150 |
api_input.blur(fn=embed_key, inputs=[api_input, study_tutor], outputs=study_tutor)
|
151 |
+
"""
|
152 |
+
|
153 |
+
"""
|
154 |
+
Another way to permanently set the key is to directly go to
|
155 |
+
Settings -> Variables and secrets -> Secrets
|
156 |
+
Then replace OPENAI_API_KEY value with whatever openai key of the instructor.
|
157 |
+
"""
|
158 |
+
api_input = os.environ.get("OPENAI_API_KEY")
|
159 |
+
study_tutor = embed_key(api_input, study_tutor)
|
160 |
|
161 |
# Upload secret prompt functionality
|
162 |
# The instructor will provide a secret prompt/persona to the tutor
|