Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,13 +36,13 @@ def chat_short_story(length, genre, theme, tone, writing_style):
|
|
36 |
)
|
37 |
|
38 |
# Retrieve the Hugging Face API key from the environment
|
39 |
-
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
40 |
if not HUGGINGFACE_API_KEY:
|
41 |
return "Error: Hugging Face API key not found. Please set the HUGGINGFACE_API_KEY environment variable."
|
42 |
|
43 |
# Initialize the Hugging Face Inference Client
|
44 |
try:
|
45 |
-
client = InferenceClient(api_key=HUGGINGFACE_API_KEY)
|
46 |
except Exception as e:
|
47 |
return f"Error: Failed to initialize Hugging Face client. Details: {e}"
|
48 |
|
|
|
36 |
)
|
37 |
|
38 |
# Retrieve the Hugging Face API key from the environment
|
39 |
+
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY").strip()
|
40 |
if not HUGGINGFACE_API_KEY:
|
41 |
return "Error: Hugging Face API key not found. Please set the HUGGINGFACE_API_KEY environment variable."
|
42 |
|
43 |
# Initialize the Hugging Face Inference Client
|
44 |
try:
|
45 |
+
client = InferenceClient(api_key=HUGGINGFACE_API_KEY)
|
46 |
except Exception as e:
|
47 |
return f"Error: Failed to initialize Hugging Face client. Details: {e}"
|
48 |
|