|
import gradio as gr |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
|
|
model_id = "sambanovasystems/SambaLingo-Turkish-Chat" |
|
|
|
|
|
model = AutoModelForCausalLM.from_pretrained(model_id) |
|
tokenizer = AutoTokenizer.from_pretrained(model_id) |
|
|
|
|
|
def respond_to_query(question): |
|
inputs = tokenizer(question, return_tensors="pt") |
|
outputs = model.generate(**inputs) |
|
response = tokenizer.decode(outputs[0], skip_special_tokens=True) |
|
return response |
|
|
|
|
|
interface = gr.Interface(fn=respond_to_query, inputs="text", outputs="text") |
|
|
|
|
|
interface.launch() |
|
|