JuiKuang commited on
Commit
f306698
·
verified ·
1 Parent(s): 15f0124

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -22
app.py CHANGED
@@ -34,33 +34,12 @@ def response(message, history):
34
  "Authorization": f"Bearer {openai_api_key}"
35
  }
36
 
37
- # 定義生成圖片的函數
38
- def generate_image(prompt):
39
- response = openai.Image.create
40
- (
41
- prompt=prompt,
42
- n=1, # 生成一張圖片
43
- size="1024x1024" # 圖片大小
44
- )
45
-
46
-
47
- # 創建 Gradio 界面
48
- iface = gr.Interface(
49
- fn=generate_image, # 使用定義的函數
50
- inputs="text", # 輸入是文本(用戶的描述)
51
- outputs="image", # 輸出是圖片
52
- title="AI 圖片生成器",
53
- description="輸入一個描述來生成圖片"
54
- )
55
-
56
- # 啟動應用
57
- iface.launch()
58
 
59
  # 設置初始的 prompt_instruction
60
  prompt_instruction = """
61
  你是專業小助教,名字叫做 '小助' ,使用繁體中文,先自我介紹及用專業、熱情、善解人意且非常有禮貌,親切的的口氣,與用戶互動並解答問題:
62
  以現在時間判斷,給予 早安、午安或晚安 問候詞
63
- description="用歐洲古典風格杯盛裝的雕花熱拿鐵"
64
  """
65
 
66
  prompt_to_gpt = prompt_instruction + message
 
34
  "Authorization": f"Bearer {openai_api_key}"
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  # 設置初始的 prompt_instruction
39
  prompt_instruction = """
40
  你是專業小助教,名字叫做 '小助' ,使用繁體中文,先自我介紹及用專業、熱情、善解人意且非常有禮貌,親切的的口氣,與用戶互動並解答問題:
41
  以現在時間判斷,給予 早安、午安或晚安 問候詞
42
+ 並顯示Emojis的熱咖啡圖案
43
  """
44
 
45
  prompt_to_gpt = prompt_instruction + message