Spaces:
Sleeping
Sleeping
Commit
·
b2d61f6
1
Parent(s):
c213d80
Add application file
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("text-generation",
|
| 5 |
+
model="Qwen/Qwen2.5-7B-Instruct")
|
| 6 |
+
|
| 7 |
+
def gerar(texto):
|
| 8 |
+
result = pipe(texto, max_new_tokens=80)
|
| 9 |
+
return result[0]["generated_text"]
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(
|
| 12 |
+
fn=gerar,
|
| 13 |
+
inputs="text",
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="Exemplo simples com Qwen"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
iface.launch()
|