Spaces:
Sleeping
Sleeping
feat: Add Chatting with llama3.1 8B
Browse files
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!???"
|
5 |
|
6 |
-
demo = gr.Interface(fn=
|
7 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
|
4 |
+
|
5 |
+
# Use a pipeline as a high-level helper
|
6 |
+
from transformers import pipeline
|
7 |
+
|
8 |
+
def llama3_1_8B(question):
|
9 |
+
messages = [
|
10 |
+
{"role": "user", "content": question},
|
11 |
+
]
|
12 |
+
pipe = pipeline("text-generation", model="meta-llama/Llama-3.1-8B-Instruct")
|
13 |
+
responses = pipe(messages)
|
14 |
+
return str(responses)
|
15 |
+
|
16 |
def greet(name):
|
17 |
return "Hello " + name + "!!???"
|
18 |
|
19 |
+
demo = gr.Interface(fn=llama3_1_8B, inputs="text", outputs="text")
|
20 |
demo.launch()
|