mgokg commited on
Commit
a284b3d
·
verified ·
1 Parent(s): 1c02999

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -7
app.py CHANGED
@@ -1,8 +1,27 @@
1
- import gradio as gr
2
- import hyperbolic_gradio
3
 
4
- gr.load(
5
- name="Qwen/Qwen2.5-72B-Instruct",
6
- src=hyperbolic_gradio.registry,
7
- accept_token=True
8
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import os
3
 
4
+ api_key=os.environ.get("HYPERBOLIC_API_KEY")
5
+ url = "https://api.hyperbolic.xyz/v1/chat/completions"
6
+
7
+ def hyperbolic(prompt):
8
+
9
+ headers = {
10
+ "Content-Type": "application/json",
11
+ "Authorization": f"Bearer {api_key}"
12
+ }
13
+ data = {
14
+ "messages": [
15
+ {
16
+ "role": "user",
17
+ "content": f"{prompt}"
18
+ }
19
+ ],
20
+ "model": "Qwen/Qwen2.5-72B-Instruct",
21
+ "max_tokens": 32768,
22
+ "temperature": 0.2,
23
+ "top_p": 0.9
24
+ }
25
+
26
+ response = requests.post(url, headers=headers, json=data)
27
+ print(response.json())