File size: 736 Bytes
56cb03d
36094dd
 
 
 
 
56cb03d
36094dd
 
6f74060
36094dd
060541a
c480dfd
 
060541a
6f74060
 
 
 
060541a
6f74060
 
 
244b584
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
import pandas as pd
import gradio as gr
from transformers import pipeline

# URL of the CSV file
csv_url = "https://huggingface.co/spaces/kataniccc/tekst/blob/main/submission.csv"

# Read the CSV file into a pandas DataFrame
df = pd.read_csv(csv_url)

# Load the model for text classification
model_nm = 'microsoft/deberta-v3-small'
classifier = pipeline("text-classification", model=model_nm)

# Define prediction function
def predict_text(input_text):
    prediction = classifier(input_text)
    return prediction

# Define Gradio interface
text_input = gr.inputs.Textbox(lines=7, label="Unesite tekst")
output_text = gr.outputs.Textbox(label="Predikcija")
gr.Interface(predict_text, inputs=text_input, outputs=output_text).launch()