Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -137,10 +137,12 @@ def restructure_topics(topics: List[Tuple[str, float]]) -> List[Tuple[str, str,
|
|
137 |
for predicted_main_topic, predicted_sub_topics in topics_as_dict.items():
|
138 |
if len(predicted_sub_topics) > 0:
|
139 |
score = [t for t in topics if t[0] == predicted_main_topic][0][1]
|
|
|
140 |
topics_restructured.append(("Main Topic", predicted_main_topic, score))
|
141 |
predicted_sub_topics_with_scores = []
|
142 |
for pst in predicted_sub_topics:
|
143 |
score = [t for t in topics if t[0] == pst][0][1]
|
|
|
144 |
entry = ("Sub Topic", pst, score)
|
145 |
if entry not in predicted_sub_topics_with_scores:
|
146 |
predicted_sub_topics_with_scores.append(entry)
|
|
|
137 |
for predicted_main_topic, predicted_sub_topics in topics_as_dict.items():
|
138 |
if len(predicted_sub_topics) > 0:
|
139 |
score = [t for t in topics if t[0] == predicted_main_topic][0][1]
|
140 |
+
predicted_main_topic = predicted_main_topic.replace("hauptthema: ", "")
|
141 |
topics_restructured.append(("Main Topic", predicted_main_topic, score))
|
142 |
predicted_sub_topics_with_scores = []
|
143 |
for pst in predicted_sub_topics:
|
144 |
score = [t for t in topics if t[0] == pst][0][1]
|
145 |
+
pst = pst.replace("unterthema: ", "")
|
146 |
entry = ("Sub Topic", pst, score)
|
147 |
if entry not in predicted_sub_topics_with_scores:
|
148 |
predicted_sub_topics_with_scores.append(entry)
|