Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,38 +6,18 @@ from transformers import pipeline
|
|
6 |
toxic_model = pipeline("text-classification", model="Matt09Miao/GP5_tweet_toxic")
|
7 |
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
# text2audio
|
12 |
-
def text2audio(toxic_result):
|
13 |
-
pipe = pipeline("text-to-audio", model="Matthijs/mms-tts-eng")
|
14 |
-
audio_data = pipe(toxic_result)
|
15 |
-
return audio_data
|
16 |
|
17 |
|
18 |
|
19 |
st.set_page_config(page_title="Generate Your Tweet and Toxicity Analysis")
|
20 |
|
21 |
-
st.header("Please input your
|
22 |
input = st.text_input("Please input your first word...")
|
23 |
|
24 |
if input is not None:
|
25 |
#Stage 1: Input to Tweet
|
26 |
-
st.text('
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
#Stage 2: Tweet Toxicity Analysis
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
#Stage 3: Story to Audio data
|
35 |
-
st.text('Generating audio data...')
|
36 |
-
audio_data =text2audio(tweet)
|
37 |
-
|
38 |
-
# Play button
|
39 |
-
if st.button("Play Audio"):
|
40 |
-
st.audio(audio_data['audio'],
|
41 |
-
format="audio/wav",
|
42 |
-
start_time=0,
|
43 |
-
sample_rate = audio_data['sampling_rate'])
|
|
|
6 |
toxic_model = pipeline("text-classification", model="Matt09Miao/GP5_tweet_toxic")
|
7 |
|
8 |
|
9 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
|
13 |
st.set_page_config(page_title="Generate Your Tweet and Toxicity Analysis")
|
14 |
|
15 |
+
st.header("Please input your Tweet for Toxicity Analysis :performing_arts:")
|
16 |
input = st.text_input("Please input your first word...")
|
17 |
|
18 |
if input is not None:
|
19 |
#Stage 1: Input to Tweet
|
20 |
+
st.text('Toxicity Analysis...')
|
21 |
+
result = toxic_model(input)
|
22 |
+
print(result)
|
23 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|