课程
《生成式 AI》课程 第3講:訓練不了人工智慧嗎?你可以訓練你自己-优快云博客
任务1:总结
1.我们希望你创建一个可以执行文章摘要的机器人。
2.设计一个提示符,使语言模型能够对文章进行总结。
model: gpt-4o-mini',#'gpt-3.5-turbo',
import requests
import gradio as gr
import json
def get_response(input_text):
url = "https://openai.api2d.net/v1/chat/completions"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer f' # <-- 把 fkxxxxx 替换成你自己的 Forward Key,注意前面的 Bearer 要保留,并且和 Key 中间有一个空格。
}
data = {
'model': 'gpt-4o-mini',#'gpt-3.5-turbo',
'messages': [{'role': 'user', 'content': f"对输入内容总结:{inpu