Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,26 +65,31 @@ class Model:
|
|
| 65 |
generated = self.model.generate(tokens, num_beams=4, max_length=256)
|
| 66 |
tgt_text = self.tokenizer.decode(generated[0], skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
| 67 |
summary = str(tgt_text).strip('[]""')
|
|
|
|
| 68 |
if 'barchart' in summary:
|
| 69 |
summary.replace('barchart','statistic')
|
| 70 |
-
|
| 71 |
summary.replace('bar graph','statistic')
|
| 72 |
-
|
| 73 |
summary.replace('bar plot','statistic')
|
| 74 |
-
|
| 75 |
summary.replace('scatter plot','statistic')
|
| 76 |
-
|
| 77 |
summary.replace('scatter graph','statistic')
|
| 78 |
-
|
| 79 |
summary.replace('scatter chart','statistic')
|
| 80 |
-
|
| 81 |
summary.replace('line plot','statistic')
|
| 82 |
-
|
| 83 |
summary.replace('line graph','statistic')
|
| 84 |
-
|
| 85 |
summary.replace('linechart','statistic')
|
|
|
|
| 86 |
if 'graph' in summary:
|
| 87 |
summary.replace('graph','statistic')
|
|
|
|
|
|
|
|
|
|
| 88 |
return summary
|
| 89 |
|
| 90 |
st.title('Chart and Data Summarization')
|
|
|
|
| 65 |
generated = self.model.generate(tokens, num_beams=4, max_length=256)
|
| 66 |
tgt_text = self.tokenizer.decode(generated[0], skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
| 67 |
summary = str(tgt_text).strip('[]""')
|
| 68 |
+
|
| 69 |
if 'barchart' in summary:
|
| 70 |
summary.replace('barchart','statistic')
|
| 71 |
+
elif 'bar graph' in summary:
|
| 72 |
summary.replace('bar graph','statistic')
|
| 73 |
+
elif 'bar plot' in summary:
|
| 74 |
summary.replace('bar plot','statistic')
|
| 75 |
+
elif 'scatter plot' in summary:
|
| 76 |
summary.replace('scatter plot','statistic')
|
| 77 |
+
elif 'scatter graph' in summary:
|
| 78 |
summary.replace('scatter graph','statistic')
|
| 79 |
+
elif 'scatterchart' in summary:
|
| 80 |
summary.replace('scatter chart','statistic')
|
| 81 |
+
elif 'line plot' in summary:
|
| 82 |
summary.replace('line plot','statistic')
|
| 83 |
+
elif 'line graph' in summary:
|
| 84 |
summary.replace('line graph','statistic')
|
| 85 |
+
elif 'linechart' in summary:
|
| 86 |
summary.replace('linechart','statistic')
|
| 87 |
+
|
| 88 |
if 'graph' in summary:
|
| 89 |
summary.replace('graph','statistic')
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
return summary
|
| 94 |
|
| 95 |
st.title('Chart and Data Summarization')
|