Spaces:
Running
Running
Cristóbal Hernández
commited on
Commit
·
da8c66e
1
Parent(s):
b52f045
Add application file
Browse files
app.py
CHANGED
@@ -121,6 +121,13 @@ def classify_output(item):
|
|
121 |
######## RUN GRADIO APP #################
|
122 |
#########################################
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
article_text = """
|
126 |
## Affect/Emotion
|
@@ -136,6 +143,9 @@ Sentences that discuss what people are focusing on or paying attention to, inclu
|
|
136 |
Statements focusing on what drives actions or behaviors. Includes stating what one values, expressing the desire to achieve particular goals, or giving reasons for acting, such as compliance or values. Also about wishing or hoping for something, which implies value. Phrases about "not caring for *something*" relates to motivation. Sentences about wanting to give up or escape may also imply motivation, e.g., escaping an aversive or an absence of motivation.
|
137 |
"""
|
138 |
|
|
|
|
|
|
|
139 |
txtbx = gr.Textbox(value = 'I would like to feel better', label = 'Please enter your item:', container = 'True')
|
140 |
txtbxopt = gr.Textbox(label = 'The item you provided was classified as:', container = 'True')
|
141 |
hf_writer = gr.HuggingFaceDatasetSaver(api_key, 'flagging_EEMM_V05')
|
|
|
121 |
######## RUN GRADIO APP #################
|
122 |
#########################################
|
123 |
|
124 |
+
import re
|
125 |
+
|
126 |
+
# Function to remove non-ASCII characters
|
127 |
+
def remove_non_ascii(text):
|
128 |
+
return re.sub(r'[^\x00-\x7F]+', ' ', text)
|
129 |
+
|
130 |
+
|
131 |
|
132 |
article_text = """
|
133 |
## Affect/Emotion
|
|
|
143 |
Statements focusing on what drives actions or behaviors. Includes stating what one values, expressing the desire to achieve particular goals, or giving reasons for acting, such as compliance or values. Also about wishing or hoping for something, which implies value. Phrases about "not caring for *something*" relates to motivation. Sentences about wanting to give up or escape may also imply motivation, e.g., escaping an aversive or an absence of motivation.
|
144 |
"""
|
145 |
|
146 |
+
# Apply the function to your Markdown strings
|
147 |
+
article = remove_non_ascii(article_text)
|
148 |
+
|
149 |
txtbx = gr.Textbox(value = 'I would like to feel better', label = 'Please enter your item:', container = 'True')
|
150 |
txtbxopt = gr.Textbox(label = 'The item you provided was classified as:', container = 'True')
|
151 |
hf_writer = gr.HuggingFaceDatasetSaver(api_key, 'flagging_EEMM_V05')
|