Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import openai
|
| 3 |
-
import
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
# Retrieve the API key and instructor prompt from environment variables
|
| 10 |
-
api_key = os.environ.get("OPENAI_API_KEY")
|
| 11 |
-
instructor_prompt = os.environ.get("INSTRUCTOR_PROMPT")
|
| 12 |
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
chat_history = gr.State(value=[])
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import openai
|
| 3 |
+
import hf
|
| 4 |
|
| 5 |
+
# Retrieve the API key from the Hugging Face secret
|
| 6 |
+
api_key = hf.secrets.get("INSTRUCTOR_API_KEY")
|
| 7 |
+
instructor_prompt = hf.secrets.get("INSTRUCTOR_PROMPT")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
with gr.Blocks() as demo:
|
| 10 |
chat_history = gr.State(value=[])
|