File size: 609 Bytes
eb3516b
 
a887949
0bb6457
 
eb3516b
0bb6457
 
eb3516b
0bb6457
 
 
 
 
eb3516b
0bb6457
eb3516b
0bb6457
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
import requests

def talk_to_llama(prompt):
    url = "https://api.nvcf.nvidia.com/v2/completions"
    headers = {
        "Authorization": "Bearer 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",
        "Content-Type": "application/json"
    }
    data = {
        "messages": [{"role": "user", "content": prompt}]
    }
    response = requests.post(url, headers=headers, json=data)
    return response.json()["choices"][0]["message"]["content"]

chat = gr.Interface(fn=talk_to_llama, inputs="text", outputs="text", title="Chat with LLaMA 4 Scout")

chat.launch()