sanbo
commited on
Commit
·
5b8eead
1
Parent(s):
442e443
update sth. at 2025-01-05 00:57:05
Browse files- Dockerfile +1 -1
- app241224.py → app250105.py +2 -3
- runway.py +34 -0
Dockerfile
CHANGED
@@ -17,4 +17,4 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
17 |
EXPOSE 7860
|
18 |
|
19 |
# 运行 Flask 应用
|
20 |
-
CMD ["python", "
|
|
|
17 |
EXPOSE 7860
|
18 |
|
19 |
# 运行 Flask 应用
|
20 |
+
CMD ["python", "app250105.py"]
|
app241224.py → app250105.py
RENAMED
@@ -16,9 +16,8 @@ def get_models():
|
|
16 |
"object": "list",
|
17 |
"data": [
|
18 |
{"id": "Qwen2.5-72B", "object": "model", "created": 0, "owned_by": "Qwen"},
|
19 |
-
{"id": "
|
20 |
-
{"id": "
|
21 |
-
{"id": "DeepSeek-Coder-V2", "object": "model", "created": 0, "owned_by": "DeepSeek"},
|
22 |
{"id": "Qwen2.5-Coder-32B", "object": "model", "created": 0, "owned_by": "Qwen"},
|
23 |
]
|
24 |
}
|
|
|
16 |
"object": "list",
|
17 |
"data": [
|
18 |
{"id": "Qwen2.5-72B", "object": "model", "created": 0, "owned_by": "Qwen"},
|
19 |
+
{"id": "Llama3.3-70B", "object": "model", "created": 0, "owned_by": "Nemotron"},
|
20 |
+
{"id": "Pixtral-124B", "object": "model", "created": 0, "owned_by": "Pixtral"},
|
|
|
21 |
{"id": "Qwen2.5-Coder-32B", "object": "model", "created": 0, "owned_by": "Qwen"},
|
22 |
]
|
23 |
}
|
runway.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
# 设置 API 密钥和请求的 URL
|
4 |
+
url = 'https://sanbo1200-degpt.hf.space/hf/v1/chat/completions'
|
5 |
+
|
6 |
+
# 构建请求头
|
7 |
+
headers = {
|
8 |
+
# 'Authorization': f'Bearer {api_key}',
|
9 |
+
'Content-Type': 'application/json',
|
10 |
+
}
|
11 |
+
|
12 |
+
# 构建请求体
|
13 |
+
data = {
|
14 |
+
'model': 'gpt-4o', # 或者使用其他可用的模型
|
15 |
+
'messages': [
|
16 |
+
{'role': 'user', 'content': '你好,你是谁?'},
|
17 |
+
],
|
18 |
+
'max_tokens': 100, # 设置生成的最大 token 数量
|
19 |
+
}
|
20 |
+
|
21 |
+
# 发送 POST 请求
|
22 |
+
response = requests.post(url, headers=headers, json=data)
|
23 |
+
|
24 |
+
# 检查响应状态
|
25 |
+
if response.status_code == 200:
|
26 |
+
# print('请求成功',response.text)
|
27 |
+
# 解析 JSON 响应
|
28 |
+
response_data = response.json()
|
29 |
+
# 获取生成的文本
|
30 |
+
generated_text = response_data['choices'][0]['message']['content']
|
31 |
+
print('ChatGPT 的回复:', generated_text)
|
32 |
+
else:
|
33 |
+
print('请求失败,状态码:', response.status_code)
|
34 |
+
print('错误信息:', response.text)
|