lunadebruyne commited on
Commit
c02823d
·
1 Parent(s): 6c96578

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -2
app.py CHANGED
@@ -9,7 +9,7 @@ import matplotlib.pyplot as plt
9
 
10
  from transformers import AutoTokenizer, AutoConfig, AutoModel, AutoModelForSequenceClassification
11
 
12
-
13
  description_sentence = "<h3>Demo EmotioNL</h3>\nThis demo allows you to analyse the emotion in a sentence."
14
  description_dataset = "<h3>Demo EmotioNL</h3>\nThis demo allows you to analyse the emotions in a dataset.\nThe data should be in tsv-format with two named columns: the first column (id) should contain the sentence IDs, and the second column (text) should contain the actual texts. Optionally, there is a third column named 'date', which specifies the date associated with the text (e.g., tweet date). This column is necessary when the options 'emotion distribution over time' and 'peaks' are selected."
15
 
@@ -102,4 +102,43 @@ iface_dataset = gr.Interface(
102
 
103
  iface = gr.TabbedInterface([iface_sentence, iface_dataset], ["Sentence", "Dataset"])
104
 
105
- iface.queue().launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  from transformers import AutoTokenizer, AutoConfig, AutoModel, AutoModelForSequenceClassification
11
 
12
+ """
13
  description_sentence = "<h3>Demo EmotioNL</h3>\nThis demo allows you to analyse the emotion in a sentence."
14
  description_dataset = "<h3>Demo EmotioNL</h3>\nThis demo allows you to analyse the emotions in a dataset.\nThe data should be in tsv-format with two named columns: the first column (id) should contain the sentence IDs, and the second column (text) should contain the actual texts. Optionally, there is a third column named 'date', which specifies the date associated with the text (e.g., tweet date). This column is necessary when the options 'emotion distribution over time' and 'peaks' are selected."
15
 
 
102
 
103
  iface = gr.TabbedInterface([iface_sentence, iface_dataset], ["Sentence", "Dataset"])
104
 
105
+ iface.queue().launch()
106
+ """
107
+
108
+ def inference_sentence(text):
109
+ output = "This sentence will be processed:\n" + text
110
+ return output
111
+
112
+
113
+
114
+
115
+ with gr.Blocks() as demo:
116
+ with gr.Tab("Sentence"):
117
+ gr.Markdown("""
118
+ # Demo EmotioNL
119
+ This demo allows you to analyse the emotion in a sentence.
120
+ """)
121
+ with gr.Row():
122
+ input = gr.Textbox(
123
+ label="Enter a sentence",
124
+ lines=1)
125
+ output = gr.Textbox()
126
+ with gr.Row():
127
+ send_btn = gr.Button("Send")
128
+ send_btn.click(fn=, inputs=input, outputs=output)
129
+ with gr.Tab("Dataset"):
130
+ gr.Markdown("""
131
+ # Demo EmotioNL
132
+ This demo allows you to analyse the emotion in a sentence.
133
+ """)
134
+ with gr.Row():
135
+ input = gr.Textbox(
136
+ label="Enter a sentence",
137
+ lines=1)
138
+ output = gr.Textbox()
139
+ with gr.Row():
140
+ send_btn = gr.Button("Send")
141
+ send_btn.click(fn=, inputs=input, outputs=output)
142
+
143
+ demo.launch()
144
+