Beeniebeen commited on
Commit
a93bcf0
โ€ข
1 Parent(s): 486e8ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +110 -15
app.py CHANGED
@@ -1,19 +1,114 @@
1
- import gradio as gr
2
- from transformers import pipeline
3
 
4
- # ๊ฐ์„ฑ ๋ถ„์„ ๋ชจ๋ธ์„ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค.
5
- sentiment = pipeline('sentiment-analysis')
 
 
6
 
7
- def get_sentiment(input_text):
8
- # ์ž…๋ ฅ ํ…์ŠคํŠธ์˜ ๊ฐ์„ฑ์„ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค.
9
- result = sentiment(input_text)[0]
10
- label = result['label']
11
- score = result['score']
12
- return f"๊ฐ์„ฑ: {label}, ์‹ ๋ขฐ๋„: {score}"
13
 
14
- # Gradio UI๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
15
- input_text = gr.inputs.Textbox(lines=7, label="ํ…์ŠคํŠธ ์ž…๋ ฅ")
16
- output_text = gr.outputs.Textbox(label="๊ฐ์„ฑ ๋ถ„์„ ๊ฒฐ๊ณผ")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
19
- gr.Interface(get_sentiment, inputs=input_text, outputs=output_text).launch()
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
 
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>Hugging Face Transformers.js</title>
7
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet">
8
 
9
+ <link rel="stylesheet" href="css/styles.css">
10
+ </head>
 
 
 
 
11
 
12
+ <body>
13
+
14
+ <div class="container-main">
15
+
16
+ <!-- Content -->
17
+ <div class="container mt-5">
18
+ <!-- Multimodal Section -->
19
+ <h2>Multimodal</h2>
20
+ <div class="row">
21
+ <div class="col-md-3">
22
+ <a href="image-to-text.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card -->
23
+ <div class="card card-custom-height">
24
+ <div class="card-body">
25
+ <h5 class="card-title">Image to Text</h5>
26
+ </div>
27
+ </div>
28
+ </a>
29
+ </div>
30
+ </div>
31
+ <!-- Natural Language Processing Section -->
32
+ <h2>Natural Language Processing</h2>
33
+ <div class="row">
34
+ <div class="col-md-3">
35
+ <a href="_se.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card -->
36
+ <div class="card card-custom-height">
37
+ <div class="card-body">
38
+ <h5 class="card-title">Text Sentiment Analysis</h5>
39
+ </div>
40
+ </div>
41
+ </a>
42
+ </div>
43
+ <div class="col-md-3">
44
+ <a href="zero-shot-classification.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card -->
45
+ <div class="card card-custom-height">
46
+ <div class="card-body">
47
+ <h5 class="card-title">Zero Shot Classification</h5>
48
+ </div>
49
+ </div>
50
+ </a>
51
+ </div>
52
+ <div class="col-md-3">
53
+ <a href="_tgen.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card -->
54
+ <div class="card card-custom-height">
55
+ <div class="card-body">
56
+ <h5 class="card-title">Text-to-text Generation</h5>
57
+ </div>
58
+ </div>
59
+ </a>
60
+ </div>
61
+ <!--
62
+ <div class="col-md-3">
63
+ <a href="promise.html" class="text-decoration-none text-dark"> <!~~ Hyperlink wrapping the card ~~>
64
+ <div class="card card-custom-height">
65
+ <div class="card-body">
66
+ <h5 class="card-title">Promise by pipeline function</h5>
67
+ </div>
68
+ </div>
69
+ </a>
70
+ </div>
71
+ -->
72
+ </div>
73
+
74
+ <!-- Computer Vision Section -->
75
+ <h2>Computer Vision</h2>
76
+ <div class="row">
77
+ <div class="col-md-3">
78
+ <a href="refs/_imgclf.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card image-classification.html -->
79
+ <div class="card card-custom-height">
80
+ <div class="card-body">
81
+ <h5 class="card-title">Image Classification</h5>
82
+ </div>
83
+ </div>
84
+ </a>
85
+ </div>
86
+ <div class="col-md-3">
87
+ <a href="zeroshotimageclassification.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card -->
88
+ <div class="card card-custom-height">
89
+ <div class="card-body">
90
+ <h5 class="card-title">Zero Shot Image Classification</h5>
91
+ </div>
92
+ </div>
93
+ </a>
94
+ </div>
95
+ <div class="col-md-3">
96
+ <a href="mobilevit.html" class="text-decoration-none text-dark"> <!-- Hyperlink wrapping the card -->
97
+ <div class="card card-custom-height">
98
+ <div class="card-body">
99
+ <h5 class="card-title">Mobile Vision</h5>
100
+ </div>
101
+ </div>
102
+ </a>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </div>
107
+
108
+ <script>
109
+ // Vanilla JavaScript code here
110
+ </script>
111
+ </body>
112
+
113
+ </html>
114