| import gradio as gr |
| import os |
| import requests |
|
|
| |
| prompt = """请你扮演一位专业领域专家,检索网络上所有信息 |
| 给出具有可靠来源的答案 |
| ######## |
| |
| |
| """ |
|
|
|
|
| key = os.getenv("baixing_key") |
| url = "https://gpt.baixing.com/" |
|
|
| |
| |
| |
| |
| |
| |
| def chat(p, qid, uid): |
| result = requests.get(url, params={"p": prompt + p, "k": key}).json()['data'] |
| return ["text", result] |
|
|
| iface = gr.Interface(fn=chat, |
| inputs=["text", "text", "text"], |
| outputs=["text", "text"], |
| description="""这是一个极其简单的示范程序,给你专家级可靠回答。 |
| [对话测试](https://huggingface.co/spaces/BaixingAI/hackathon_test) [参考文档](https://huggingface.co/spaces/baixing/hackathon_test/blob/main/bot-api.md) [Q & A](https://huggingface.co/spaces/baixing/hackathon_test/blob/main/qna.md) |
| """ |
| ) |
| iface.launch() |