Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
|
|
@@ -50,8 +116,8 @@ demo = gr.ChatInterface(
|
|
| 50 |
respond,
|
| 51 |
additional_inputs=[
|
| 52 |
gr.Textbox(
|
| 53 |
-
value="
|
| 54 |
-
|
| 55 |
1. Emotion Temperature Code (2 characters):
|
| 56 |
- If the emotion is purely Cold: Use CC
|
| 57 |
- If the emotion is purely Warm: Use WW
|
|
@@ -87,7 +153,6 @@ The output would be: CW02305000010
|
|
| 87 |
|
| 88 |
Output Format:
|
| 89 |
Always return a 13-character code following this structure.""",
|
| 90 |
-
label="Instruction",
|
| 91 |
lines=10,
|
| 92 |
),
|
| 93 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
|
|
|
| 1 |
+
Toxic (1):
|
| 2 |
+
Appreciation (2):
|
| 3 |
+
Constructive Criticism (3):
|
| 4 |
+
Genuine Questions (4):
|
| 5 |
+
Advice/Suggestions (5):
|
| 6 |
+
Requests (6):
|
| 7 |
+
Spam (7):
|
| 8 |
+
Off-Topic (8):
|
| 9 |
+
Engagement Boosters (9):
|
| 10 |
+
Neutral/General (10):
|
| 11 |
+
Hate (11):
|
| 12 |
+
|
| 13 |
+
00000000010
|
| 14 |
+
|
| 15 |
+
Prompt for AI Agent:
|
| 16 |
+
|
| 17 |
+
You are tasked with labeling text data based on both emotion temperature and text type categories. The final output must be a 13-character code that consists of the following structure:
|
| 18 |
+
|
| 19 |
+
Emotion Temperature Code (2 characters):
|
| 20 |
+
|
| 21 |
+
If the emotion is purely Cold: Use CC
|
| 22 |
+
If the emotion is purely Warm: Use WW
|
| 23 |
+
If the emotion is purely Hot: Use HH
|
| 24 |
+
If the emotion is a mix, use one of the following:
|
| 25 |
+
Cold and Warm: Use CW
|
| 26 |
+
Warm and Hot: Use WH
|
| 27 |
+
Cold and Hot: Use CH
|
| 28 |
+
Text Type Codes (next 9 digits):
|
| 29 |
+
Assign a digit for each of the following categories based on the presence in the text. Use 0 for categories not applicable:
|
| 30 |
+
|
| 31 |
+
1: Toxic
|
| 32 |
+
2: Appreciation
|
| 33 |
+
3: Constructive Criticism
|
| 34 |
+
4: Genuine Questions
|
| 35 |
+
5: Advice/Suggestions
|
| 36 |
+
6: Requests
|
| 37 |
+
7: Spam
|
| 38 |
+
8: Off-Topic
|
| 39 |
+
9: Engagement Boosters
|
| 40 |
+
Special Categories (last 2 digits):
|
| 41 |
+
|
| 42 |
+
If the text is Neutral/General: Set the 10th digit to 1; otherwise, set it to 0.
|
| 43 |
+
If the text contains Hate: Set the last digit (11th) to 1; otherwise, set it to 0.
|
| 44 |
+
Example:
|
| 45 |
+
For the text "I love your videos but still something is missing":
|
| 46 |
+
|
| 47 |
+
Emotion: Cold and Warm (CW)
|
| 48 |
+
Types Detected: 2 (Appreciation), 3 (Constructive Criticism), 5 (Advice/Suggestions)
|
| 49 |
+
Special Categories: Neutral/General (set the 10th digit to 1), no Hate
|
| 50 |
+
The output would be: CW02305000010
|
| 51 |
+
|
| 52 |
+
Output Format:
|
| 53 |
+
Always return a only 13-character code following this structure.
|
| 54 |
+
|
| 55 |
+
am getting this error "ImportError: cannot import name 'main' from partially initialized module 'data_labelling' (most likely due to a circular import) (/home/user/app/data_labelling.py)
|
| 56 |
+
Traceback:
|
| 57 |
+
File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling
|
| 58 |
+
result = func()
|
| 59 |
+
File "/usr/local/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec
|
| 60 |
+
exec(code, module.__dict__)
|
| 61 |
+
File "/home/user/app/app.py", line 7, in <module>
|
| 62 |
+
from data_labelling import label_dataset
|
| 63 |
+
File "/home/user/app/data_labelling.py", line 3, in <module>
|
| 64 |
+
from data_labelling import main as label_data" also i forget mention one more thing , I need a option to select which are the Columns needs to labelled and that column name , these two options Needs to be asked
|
| 65 |
+
|
| 66 |
+
|
| 67 |
import gradio as gr
|
| 68 |
from huggingface_hub import InferenceClient
|
| 69 |
|
|
|
|
| 116 |
respond,
|
| 117 |
additional_inputs=[
|
| 118 |
gr.Textbox(
|
| 119 |
+
value="You are tasked with labeling text data based on both emotion temperature and text type categories. The final output must be a 13-character code that consists of the following structure",
|
| 120 |
+
label="""
|
| 121 |
1. Emotion Temperature Code (2 characters):
|
| 122 |
- If the emotion is purely Cold: Use CC
|
| 123 |
- If the emotion is purely Warm: Use WW
|
|
|
|
| 153 |
|
| 154 |
Output Format:
|
| 155 |
Always return a 13-character code following this structure.""",
|
|
|
|
| 156 |
lines=10,
|
| 157 |
),
|
| 158 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|