AbrorBalxiyev's picture
add project
7938776 verified
raw
history blame
794 Bytes
import gradio as gr
from transformers import pipeline
# Pipeline-ni o'rnatish
pipe = pipeline("text-classification", model="AbrorBalxiyev/my_awesome_model")
# Klassifikatsiya funksiyasi
def classify_text(text):
results = pipe(text)
output = {result['label']: f"{result['score'] * 100:.2f}%" for result in results}
return output
# Gradio interfeysini yaratish
with gr.Blocks() as demo:
gr.Markdown("## Text Classification Pipeline")
text_input = gr.Textbox(label="Enter Text", placeholder="Type something here...")
output_label = gr.Label(label="Classification Results")
classify_button = gr.Button("Classify")
classify_button.click(classify_text, inputs=text_input, outputs=output_label)
# Interfeysni ishga tushirish
demo.launch()