tsengiii commited on
Commit
a56edad
·
verified ·
1 Parent(s): ee62d96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,3 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
  # Define a function for your model's functionality
 
1
+ import time
2
+ import gradio as gr
3
+ import openai
4
+ import os
5
+ import requests
6
+ import json
7
+
8
+ # 從 Hugging Face secrets 中讀取 OpenAI API 金鑰
9
+ api_key = os.getenv('OPENAI_API_KEY')
10
+ if not api_key:
11
+ raise ValueError("請設置 'OPENAI_API_KEY' 環境變數")
12
+
13
+ # OpenAI API key
14
+ openai_api_key = api_key
15
  import gradio as gr
16
 
17
  # Define a function for your model's functionality