Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
gr.load(
|
| 4 |
"meta-llama/Llama-3.2-1B-Instruct",
|
| 5 |
src = "models",
|
| 6 |
inputs = [gr.Textbox(label = "Input")],
|
|
@@ -9,4 +12,28 @@ gr.load(
|
|
| 9 |
examples = [
|
| 10 |
["Hello, World."]
|
| 11 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
).launch()
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
# Inference
|
| 3 |
+
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
+
app = gr.load(
|
| 7 |
"meta-llama/Llama-3.2-1B-Instruct",
|
| 8 |
src = "models",
|
| 9 |
inputs = [gr.Textbox(label = "Input")],
|
|
|
|
| 12 |
examples = [
|
| 13 |
["Hello, World."]
|
| 14 |
]
|
| 15 |
+
).launch()
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
# Pipeline
|
| 19 |
+
|
| 20 |
+
import gradio as gr
|
| 21 |
+
from transformers import pipeline
|
| 22 |
+
|
| 23 |
+
pipe = pipeline(model = "meta-llama/Llama-3.2-1B-Instruct")
|
| 24 |
+
|
| 25 |
+
def fn(input):
|
| 26 |
+
output = pipe(
|
| 27 |
+
input,
|
| 28 |
+
)
|
| 29 |
+
return output[0]["generated_text"]#[len(input):]
|
| 30 |
+
|
| 31 |
+
app = gr.Interface(
|
| 32 |
+
fn = fn,
|
| 33 |
+
inputs = [gr.Textbox(label = "Input")],
|
| 34 |
+
outputs = [gr.Textbox(label = "Output")],
|
| 35 |
+
title = "Demo",
|
| 36 |
+
examples = [
|
| 37 |
+
["Hello, World."]
|
| 38 |
+
]
|
| 39 |
).launch()
|