Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,24 @@
|
|
|
|
|
|
|
|
1 |
# function part
|
2 |
# Toxicity Analysis
|
3 |
-
|
4 |
-
|
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 |
-
|
12 |
-
return
|
13 |
|
14 |
# text2audio
|
15 |
-
def text2audio(
|
16 |
pipe = pipeline("text-to-audio", model="Matthijs/mms-tts-eng")
|
17 |
-
audio_data = pipe(
|
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 |
|