Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,10 +7,10 @@ import os
|
|
| 7 |
import spaces
|
| 8 |
|
| 9 |
# Text Expansion Model (ZeroGPU compatible)
|
| 10 |
-
text_generator = pipeline("
|
| 11 |
|
| 12 |
-
# Text-to-Speech Model (
|
| 13 |
-
tts_pipeline = pipeline("text-to-speech", model="
|
| 14 |
|
| 15 |
# Image Generation Model (LoRA-based)
|
| 16 |
image_generator = pipeline("text-to-image", model="stabilityai/sdxl-turbo")
|
|
@@ -20,19 +20,15 @@ image_generator = pipeline("text-to-image", model="stabilityai/sdxl-turbo")
|
|
| 20 |
def generate_cartoon(script_text):
|
| 21 |
# Step 1: Expand Script
|
| 22 |
prompt = f"""
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
1. Scene description (setting + action)
|
| 26 |
2. Dialogue
|
| 27 |
3. Characters involved
|
| 28 |
4. Background description
|
| 29 |
|
| 30 |
Story:
|
| 31 |
-
"""
|
| 32 |
{script_text}
|
| 33 |
"""
|
| 34 |
-
Return result in JSON format.
|
| 35 |
-
"""
|
| 36 |
|
| 37 |
response = text_generator(prompt, max_new_tokens=1024)[0]['generated_text']
|
| 38 |
|
|
|
|
| 7 |
import spaces
|
| 8 |
|
| 9 |
# Text Expansion Model (ZeroGPU compatible)
|
| 10 |
+
text_generator = pipeline("text2text-generation", model="google/flan-t5-large")
|
| 11 |
|
| 12 |
+
# Text-to-Speech Model (ZeroGPU compatible)
|
| 13 |
+
tts_pipeline = pipeline("text-to-speech", model="facebook/fastspeech2-en-ljspeech")
|
| 14 |
|
| 15 |
# Image Generation Model (LoRA-based)
|
| 16 |
image_generator = pipeline("text-to-image", model="stabilityai/sdxl-turbo")
|
|
|
|
| 20 |
def generate_cartoon(script_text):
|
| 21 |
# Step 1: Expand Script
|
| 22 |
prompt = f"""
|
| 23 |
+
Convert the following cartoon story into a detailed scene plan in JSON format. For each scene, provide:
|
| 24 |
+
1. Scene description
|
|
|
|
| 25 |
2. Dialogue
|
| 26 |
3. Characters involved
|
| 27 |
4. Background description
|
| 28 |
|
| 29 |
Story:
|
|
|
|
| 30 |
{script_text}
|
| 31 |
"""
|
|
|
|
|
|
|
| 32 |
|
| 33 |
response = text_generator(prompt, max_new_tokens=1024)[0]['generated_text']
|
| 34 |
|