Spaces:
Sleeping
Sleeping
File size: 865 Bytes
e7946d3 f2fc59a 6840d2d f2fc59a 6840d2d f2fc59a 6840d2d f2fc59a 6840d2d f2fc59a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
from transformers import pipeline
import gradio as gr
generator = pipeline("text-generation",
model= "Qwen/Qwen3-4B-Instruct-2507",
dtype = "auto",
device_map="auto")
def generate_text(prompt):
messages = [
{
"role": "system",
"content": "Sen Türkçe cevap veren, yardımcı bir yapay zeka asistansın."
},
{
"role": "user",
"content": prompt
}
]
outputs = generator(
messages,
max_new_tokens = 100,
do_sample = True,
temperature = 0.7,
return_full_text=False
)
return outputs[0]["generated_text"]
demo = gr.Interface(
fn=generate_text,
inputs=gr.Textbox(label="Give an input"),
outputs = gr.Textbox(label="Output", lines=10),
title = "Text Generation"
)
demo.launch() |