Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,10 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
from gradio_client import Client # ์ด๋ฏธ์ง ์์ฑ API ํด๋ผ์ด์ธํธ
|
|
|
5 |
|
|
|
|
|
6 |
# ํ๊ฒฝ ๋ณ์์์ Hugging Face API ํ ํฐ์ ๊ฐ์ ธ์ต๋๋ค.
|
7 |
hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("HF_TOKEN"))
|
8 |
|
@@ -46,9 +49,18 @@ def respond(
|
|
46 |
return result['url']
|
47 |
else:
|
48 |
return "์ด๋ฏธ์ง ์์ฑ์ ์คํจํ์ต๋๋ค."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
except Exception as e:
|
|
|
50 |
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
51 |
-
|
52 |
theme = "Nymbo/Nymbo_Theme"
|
53 |
css = """
|
54 |
footer {
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import os
|
4 |
from gradio_client import Client # ์ด๋ฏธ์ง ์์ฑ API ํด๋ผ์ด์ธํธ
|
5 |
+
import logging
|
6 |
|
7 |
+
# ๋ก๊น
์ค์
|
8 |
+
logging.basicConfig(level=logging.INFO)
|
9 |
# ํ๊ฒฝ ๋ณ์์์ Hugging Face API ํ ํฐ์ ๊ฐ์ ธ์ต๋๋ค.
|
10 |
hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("HF_TOKEN"))
|
11 |
|
|
|
49 |
return result['url']
|
50 |
else:
|
51 |
return "์ด๋ฏธ์ง ์์ฑ์ ์คํจํ์ต๋๋ค."
|
52 |
+
|
53 |
+
try:
|
54 |
+
result = client.predict(...)
|
55 |
+
if 'url' in result:
|
56 |
+
return result['url']
|
57 |
+
else:
|
58 |
+
logging.error("์ด๋ฏธ์ง ์์ฑ ์คํจ: %s", result.get('error', '์ ์ ์๋ ์ค๋ฅ'))
|
59 |
+
return "์ด๋ฏธ์ง ์์ฑ์ ์คํจํ์ต๋๋ค."
|
60 |
except Exception as e:
|
61 |
+
logging.error("API ์์ฒญ ์ค ์ค๋ฅ ๋ฐ์: %s", str(e))
|
62 |
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
63 |
+
|
64 |
theme = "Nymbo/Nymbo_Theme"
|
65 |
css = """
|
66 |
footer {
|