nndly46 commited on
Commit
ea9eb2b
·
verified ·
1 Parent(s): 8c6ae9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -1,6 +1,15 @@
1
  import os
2
  import gradio as gr
3
 
 
 
 
 
 
 
 
 
 
4
  from haystack.components.generators.chat import HuggingFaceAPIChatGenerator
5
  from haystack.components.builders.chat_prompt_builder import ChatPromptBuilder
6
  from haystack.dataclasses import ChatMessage
@@ -8,6 +17,7 @@ from haystack import Pipeline
8
  from haystack.utils import Secret
9
  from image_captioner import ImageCaptioner
10
 
 
11
  description = """
12
  # Captionate 📸
13
  ### Create Instagram captions for your pics!
 
1
  import os
2
  import gradio as gr
3
 
4
+ # ดึงค่า API Key จาก Hugging Face Secrets
5
+ hf_api_key = os.environ.get("HF_API_KEY")
6
+
7
+ # ตรวจสอบว่า API Key ถูกดึงออกมาหรือยัง
8
+ if hf_api_key:
9
+ print(f"API Key Loaded: {hf_api_key}")
10
+ else:
11
+ print("API Key not found. Please check your Hugging Face secrets.")
12
+
13
  from haystack.components.generators.chat import HuggingFaceAPIChatGenerator
14
  from haystack.components.builders.chat_prompt_builder import ChatPromptBuilder
15
  from haystack.dataclasses import ChatMessage
 
17
  from haystack.utils import Secret
18
  from image_captioner import ImageCaptioner
19
 
20
+
21
  description = """
22
  # Captionate 📸
23
  ### Create Instagram captions for your pics!