Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from huggingface_hub import InferenceClient
|
3 |
+
import spaces
|
4 |
+
|
5 |
+
client = InferenceClient("meta-llama/Meta-Llama-3-70B-Instruct")
|
6 |
+
messages=[]
|
7 |
+
client.chat_completion(messages, max_tokens=1024)
|
8 |
+
|
9 |
+
@spaces.GPU()
|
10 |
+
def respond(prompt):
|
11 |
+
response = client.chat_completion(
|
12 |
+
model="meta-llama/Meta-Llama-3-70B-Instruct",
|
13 |
+
messages=messages,
|
14 |
+
max_tokens=500,
|
15 |
+
)
|
16 |
+
return response.content
|
17 |
+
|
18 |
+
gr.ChatInterface(respond).launch()
|