Matt09Miao commited on
Commit
ffd4428
·
verified ·
1 Parent(s): d2b35f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -1,25 +1,24 @@
 
 
 
1
  # function part
2
  # Toxicity Analysis
3
- def toxic(text_tweet):
4
- image_model = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
5
- text = image_to_text_model(url)[0]["generated_text"]
6
- return text
7
 
8
  # text2story
9
  def text2story(text):
10
  pipe = pipeline("text-generation", model="pranavpsv/genre-story-generator-v2")
11
- story_text = pipe(text)[0]['generated_text']
12
- return story_text
13
 
14
  # text2audio
15
- def text2audio(story_text):
16
  pipe = pipeline("text-to-audio", model="Matthijs/mms-tts-eng")
17
- audio_data = pipe(story_text)
18
  return audio_data
19
 
20
 
21
- import streamlit as st
22
- from transformers import pipeline
23
 
24
  st.set_page_config(page_title="Generate Your Tweet and Toxicity Analysis")
25
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
  # function part
5
  # Toxicity Analysis
6
+ toxic_model= pipeline("text-classification", model="Matt09Miao/GP5_tweet_toxic",return_all_scores=True))
7
+
 
 
8
 
9
  # text2story
10
  def text2story(text):
11
  pipe = pipeline("text-generation", model="pranavpsv/genre-story-generator-v2")
12
+ tweet_text_text = pipe(text)[0]['generated_text']
13
+ return tweet_text
14
 
15
  # text2audio
16
+ def text2audio(toxic_result):
17
  pipe = pipeline("text-to-audio", model="Matthijs/mms-tts-eng")
18
+ audio_data = pipe(toxic_result)
19
  return audio_data
20
 
21
 
 
 
22
 
23
  st.set_page_config(page_title="Generate Your Tweet and Toxicity Analysis")
24