File size: 373 Bytes
b2d61f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

pipe = pipeline("text-generation",
                model="Qwen/Qwen2.5-7B-Instruct")

def gerar(texto):
    result = pipe(texto, max_new_tokens=80)
    return result[0]["generated_text"]

iface = gr.Interface(
    fn=gerar,
    inputs="text",
    outputs="text",
    title="Exemplo simples com Qwen"
)

iface.launch()