Spaces:
Runtime error
Runtime error
lhzstar
commited on
Commit
•
b55470f
1
Parent(s):
b190683
new commits
Browse files- celebbot.py +2 -1
- run_eval.py +1 -1
- test.py +5 -0
celebbot.py
CHANGED
@@ -12,7 +12,7 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, AutoModel
|
|
12 |
import pickle
|
13 |
import streamlit as st
|
14 |
from sklearn.metrics.pairwise import cosine_similarity
|
15 |
-
|
16 |
|
17 |
# Build the AI
|
18 |
class CelebBot():
|
@@ -55,6 +55,7 @@ class CelebBot():
|
|
55 |
return True if "hey " + self.name in text.lower() else False
|
56 |
|
57 |
def text_to_speech(self, autoplay=True):
|
|
|
58 |
return run_tts.tts(self.text, "_".join(self.name.split(" ")), self.spacy_model, autoplay)
|
59 |
|
60 |
def sentence_embeds_inference(self, texts: list):
|
|
|
12 |
import pickle
|
13 |
import streamlit as st
|
14 |
from sklearn.metrics.pairwise import cosine_similarity
|
15 |
+
|
16 |
|
17 |
# Build the AI
|
18 |
class CelebBot():
|
|
|
55 |
return True if "hey " + self.name in text.lower() else False
|
56 |
|
57 |
def text_to_speech(self, autoplay=True):
|
58 |
+
import run_tts
|
59 |
return run_tts.tts(self.text, "_".join(self.name.split(" ")), self.spacy_model, autoplay)
|
60 |
|
61 |
def sentence_embeds_inference(self, texts: list):
|
run_eval.py
CHANGED
@@ -85,7 +85,7 @@ def evaluate_system():
|
|
85 |
print(f"ROUGE: {round(results['rougeL'], 2)}")
|
86 |
|
87 |
bertscore = evaluate.load("bertscore")
|
88 |
-
results = bertscore.compute(predictions=predictions, references=references, lang="en")
|
89 |
print(f"F1: {round(sum(results['f1'])/len(results['f1']))}")
|
90 |
|
91 |
if __name__ == "__main__":
|
|
|
85 |
print(f"ROUGE: {round(results['rougeL'], 2)}")
|
86 |
|
87 |
bertscore = evaluate.load("bertscore")
|
88 |
+
results = bertscore.compute(predictions=predictions, references=references, rescale_with_baseline=True, lang="en")
|
89 |
print(f"F1: {round(sum(results['f1'])/len(results['f1']))}")
|
90 |
|
91 |
if __name__ == "__main__":
|
test.py
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import evaluate
|
2 |
+
|
3 |
+
bertscore = evaluate.load("bertscore")
|
4 |
+
results = bertscore.compute(predictions=["I am from Toronto."], references=["Hey"],rescale_with_baseline=True, lang="en")
|
5 |
+
print(results)
|