Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py.txt
Browse files- app.py.txt +17 -0
app.py.txt
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr, transformers
|
2 |
+
|
3 |
+
pipe = transformers.pipeline("text-generation",
|
4 |
+
model="marcelbinz/Llama-3.1-Minitaur-8B")
|
5 |
+
|
6 |
+
def infer(prompt, max_tokens):
|
7 |
+
return pipe(prompt, max_new_tokens=int(max_tokens))[0]["generated_text"]
|
8 |
+
|
9 |
+
demo = gr.Interface(
|
10 |
+
fn=infer,
|
11 |
+
inputs=[gr.Textbox(label="Prompt"),
|
12 |
+
gr.Slider(5,128,32,step=1,label="Max tokens")],
|
13 |
+
outputs="text",
|
14 |
+
title="Minitaur",
|
15 |
+
description="Just type and hit *Run*"
|
16 |
+
)
|
17 |
+
demo.launch()
|