yangheng commited on
Commit
69014e8
Β·
verified Β·
1 Parent(s): 047222e

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -6
  2. app.py +3 -1
  3. requirements.txt +1 -2
README.md CHANGED
@@ -1,13 +1,13 @@
1
  ---
2
- title: Multilingual Aspect Based Sentiment Analysis
3
- emoji: πŸŒ–
4
- colorFrom: green
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 5.8.0
8
  app_file: app.py
9
- pinned: false
10
  license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
 
1
  ---
2
+ title: PyABSA
3
+ emoji: πŸ‘‹
4
+ colorFrom: pink
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 4.36.1
8
  app_file: app.py
9
+ pinned: true
10
  license: mit
11
  ---
12
 
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -162,7 +162,7 @@ def perform_aste_inference(text, dataset):
162
  result = triplet_extractor.predict(text)
163
 
164
  pred_triplets = pd.DataFrame(result["Triplets"])
165
- true_triplets = pd.DataFrame(result["True Triplets"])
166
  return pred_triplets, true_triplets, "{}".format(text.split("####")[0])
167
 
168
 
@@ -180,6 +180,8 @@ def perform_acos_inference(text, dataset):
180
 
181
 
182
  def run_demo(text, dataset, task):
 
 
183
  try:
184
  data = {
185
  "text": text,
 
162
  result = triplet_extractor.predict(text)
163
 
164
  pred_triplets = pd.DataFrame(result["Triplets"])
165
+ true_triplets = pd.DataFrame(result["True Triplets"]) if result["True Triplets"] else None
166
  return pred_triplets, true_triplets, "{}".format(text.split("####")[0])
167
 
168
 
 
180
 
181
 
182
  def run_demo(text, dataset, task):
183
+ if len(text) > 3000:
184
+ raise RuntimeError('Text is too long!')
185
  try:
186
  data = {
187
  "text": text,
requirements.txt CHANGED
@@ -1,3 +1,2 @@
1
  pyabsa>=2.1.12
2
- transformers<=4.29.0
3
- setuptools<65
 
1
  pyabsa>=2.1.12
2
+ transformers<=4.29.0