AbrorBalxiyev commited on
Commit
a2fc443
·
verified ·
1 Parent(s): bb704b7

add something

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -1,23 +1,23 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
-
4
- # Pipeline-ni o'rnatish
5
- pipe = pipeline("text-classification", model="AbrorBalxiyev/my_awesome_model")
6
-
7
- # Klassifikatsiya funksiyasi
8
- def classify_text(text):
9
- results = pipe(text)
10
- output = {result['label']: f"{result['score'] * 100:.2f}%" for result in results}
11
- return output
12
-
13
- # Gradio interfeysini yaratish
14
- with gr.Blocks() as demo:
15
- gr.Markdown("## Text Classification Pipeline")
16
- text_input = gr.Textbox(label="Enter Text", placeholder="Type something here...")
17
- output_label = gr.Label(label="Classification Results")
18
- classify_button = gr.Button("Classify")
19
-
20
- classify_button.click(classify_text, inputs=text_input, outputs=output_label)
21
-
22
- # Interfeysni ishga tushirish
23
  demo.launch()
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Pipeline-ni o'rnatish
5
+ pipe = pipeline("text-classification", model="AbrorBalxiyev/my_awesome_model")
6
+
7
+ # Klassifikatsiya funksiyasi
8
+ def classify_text(text):
9
+ results = pipe(text)
10
+ output = {result['label']: f"{result['score'] * 100:.2f}%" for result in results[0]}
11
+ return output
12
+
13
+ # Gradio interfeysini yaratish
14
+ with gr.Blocks() as demo:
15
+ gr.Markdown("## Text Classification Pipeline")
16
+ text_input = gr.Textbox(label="Enter Text", placeholder="Type something here...")
17
+ output_label = gr.Label(label="Classification Results")
18
+ classify_button = gr.Button("Classify")
19
+
20
+ classify_button.click(classify_text, inputs=text_input, outputs=output_label)
21
+
22
+ # Interfeysni ishga tushirish
23
  demo.launch()