Spaces:
Running
on
Zero
Running
on
Zero
init
Browse files
README.md
CHANGED
@@ -9,6 +9,7 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
short_description: Skywork/Skywork-o1-Open-PRM-Qwen-2.5-7B
|
|
|
12 |
---
|
13 |
|
14 |
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
|
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
short_description: Skywork/Skywork-o1-Open-PRM-Qwen-2.5-7B
|
12 |
+
hf_oauth: true
|
13 |
---
|
14 |
|
15 |
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
app.py
CHANGED
@@ -2,6 +2,8 @@ import spaces
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
|
5 |
|
6 |
# 定义系统提示语
|
7 |
system_prompt = """你是 Skywork-o1,Skywork AI 开发的思维模型,擅长通过深度思考解决涉及数学、编码和逻辑推理的复杂问题。面对用户请求时,你首先会进行一段漫长而深入的思考过程,探索问题的可能解决方案。完成思考后,你会在回复中详细解释解决过程。"""
|
@@ -75,5 +77,23 @@ demo = gr.ChatInterface(
|
|
75 |
# chatbot_style="default"
|
76 |
)
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
if __name__ == "__main__":
|
79 |
demo.launch()
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
+
from __future__ import annotations
|
6 |
+
from huggingface_hub import whoami
|
7 |
|
8 |
# 定义系统提示语
|
9 |
system_prompt = """你是 Skywork-o1,Skywork AI 开发的思维模型,擅长通过深度思考解决涉及数学、编码和逻辑推理的复杂问题。面对用户请求时,你首先会进行一段漫长而深入的思考过程,探索问题的可能解决方案。完成思考后,你会在回复中详细解释解决过程。"""
|
|
|
77 |
# chatbot_style="default"
|
78 |
)
|
79 |
|
80 |
+
def hello(profile: gr.OAuthProfile | None) -> str:
|
81 |
+
if profile is None:
|
82 |
+
return "I don't know you."
|
83 |
+
return f"Hello {profile.name}"
|
84 |
+
|
85 |
+
def list_organizations(oauth_token: gr.OAuthToken | None) -> str:
|
86 |
+
if oauth_token is None:
|
87 |
+
return "Please deploy this on Spaces and log in to list organizations."
|
88 |
+
org_names = [org["name"] for org in whoami(oauth_token.token)["orgs"]]
|
89 |
+
return f"You belong to {', '.join(org_names)}."
|
90 |
+
|
91 |
+
with gr.Blocks() as demo:
|
92 |
+
gr.LoginButton()
|
93 |
+
m1 = gr.Markdown()
|
94 |
+
m2 = gr.Markdown()
|
95 |
+
demo.load(hello, inputs=None, outputs=m1)
|
96 |
+
demo.load(list_organizations, inputs=None, outputs=m2)
|
97 |
+
|
98 |
if __name__ == "__main__":
|
99 |
demo.launch()
|