arts1986 commited on
Commit
84665a6
·
verified ·
1 Parent(s): d684f1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -1,10 +1,19 @@
1
- import gradio as gr
 
2
 
3
- with gr.Blocks(fill_height=True) as demo:
4
- with gr.Sidebar():
5
- gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the deepseek-ai/DeepSeek-V3.2 model, served by the novita API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/deepseek-ai/DeepSeek-V3.2", accept_token=button, provider="novita")
9
-
10
- demo.launch()
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from openai import OpenAI
3
 
4
+ client = OpenAI(
5
+ base_url="https://router.huggingface.co/v1",
6
+ api_key=os.environ["HF_TOKEN"],
7
+ )
8
+
9
+ completion = client.chat.completions.create(
10
+ model="deepseek-ai/DeepSeek-V3.2:novita",
11
+ messages=[
12
+ {
13
+ "role": "user",
14
+ "content": "What is the capital of France?"
15
+ }
16
+ ],
17
+ )
18
+
19
+ print(completion.choices[0].message)