Matt09Miao commited on
Commit
fa0b08d
·
verified ·
1 Parent(s): 3eecdbe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -26
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
- text2tweet = pipeline("text2text-generation", model="google/t5-v1_1-base")
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 first word of a Tweet :performing_arts:")
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('Generating a Tweet...')
27
- tweet = text2tweet(input)
28
- st.write(tweet)
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
+