Update app.py
Browse files
app.py
CHANGED
|
@@ -36,17 +36,16 @@ def generate_text(prompt, max_length=100):
|
|
| 36 |
|
| 37 |
# Hàm hiển thị thông tin API
|
| 38 |
def get_api_info():
|
| 39 |
-
#
|
| 40 |
-
|
| 41 |
-
base_url = "http://localhost:7860" if gr.context.local else "https://<your-space-name>.hf.space"
|
| 42 |
return (
|
| 43 |
"Welcome to Qwen2.5-0.5B API!\n"
|
| 44 |
-
f"API Base URL: {base_url}\n"
|
| 45 |
"Endpoints:\n"
|
| 46 |
f"- GET {base_url}/api/health_check (Check API status)\n"
|
| 47 |
f"- POST {base_url}/api/generate (Generate text)\n"
|
| 48 |
"To use the generate API, send a POST request with JSON:\n"
|
| 49 |
-
'{"
|
| 50 |
)
|
| 51 |
|
| 52 |
# Hàm kiểm tra sức khỏe (dành cho API)
|
|
|
|
| 36 |
|
| 37 |
# Hàm hiển thị thông tin API
|
| 38 |
def get_api_info():
|
| 39 |
+
# Dùng placeholder, người dùng sẽ thay bằng URL thực tế của Space
|
| 40 |
+
base_url = "https://<your-space-name>.hf.space"
|
|
|
|
| 41 |
return (
|
| 42 |
"Welcome to Qwen2.5-0.5B API!\n"
|
| 43 |
+
f"API Base URL: {base_url} (Replace '<your-space-name>' with your actual Space name)\n"
|
| 44 |
"Endpoints:\n"
|
| 45 |
f"- GET {base_url}/api/health_check (Check API status)\n"
|
| 46 |
f"- POST {base_url}/api/generate (Generate text)\n"
|
| 47 |
"To use the generate API, send a POST request with JSON:\n"
|
| 48 |
+
'{"0": "your prompt", "1": 150}'
|
| 49 |
)
|
| 50 |
|
| 51 |
# Hàm kiểm tra sức khỏe (dành cho API)
|