Spaces:
Configuration error
Configuration error
Upload Mostafagouda_complete.zip
#1
by
Mostafatremox
- opened
- README.md +14 -0
- app.py +59 -0
- requirements.txt +11 -0
README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Gouda
|
| 3 |
+
emoji: 🏢
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "4.25.0"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
short_description: Smart AI Studio for videos, images, and voice from text.
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Gouda - AI-Powered Multimedia Studio
|
app.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pyttsx3
|
| 3 |
+
import os
|
| 4 |
+
from PIL import Image
|
| 5 |
+
from gtts import gTTS
|
| 6 |
+
import moviepy.editor as mp
|
| 7 |
+
from transformers import pipeline
|
| 8 |
+
|
| 9 |
+
# TTS with pyttsx3
|
| 10 |
+
def tts_pyttsx3(text):
|
| 11 |
+
engine = pyttsx3.init()
|
| 12 |
+
engine.save_to_file(text, "audio.mp3")
|
| 13 |
+
engine.runAndWait()
|
| 14 |
+
return "audio.mp3"
|
| 15 |
+
|
| 16 |
+
# TTS with gTTS
|
| 17 |
+
def tts_gtts(text):
|
| 18 |
+
tts = gTTS(text)
|
| 19 |
+
tts.save("audio_gtts.mp3")
|
| 20 |
+
return "audio_gtts.mp3"
|
| 21 |
+
|
| 22 |
+
# Generate image from prompt using placeholder
|
| 23 |
+
def generate_image(prompt):
|
| 24 |
+
img = Image.new("RGB", (512, 512), color=(73, 109, 137))
|
| 25 |
+
return img
|
| 26 |
+
|
| 27 |
+
# Combine text, image, and audio into video
|
| 28 |
+
def generate_video(text, prompt):
|
| 29 |
+
image_path = "frame.jpg"
|
| 30 |
+
audio_path = tts_gtts(text)
|
| 31 |
+
generate_image(prompt).save(image_path)
|
| 32 |
+
clip = mp.ImageClip(image_path).set_duration(5).set_audio(mp.AudioFileClip(audio_path))
|
| 33 |
+
video_path = "output_video.mp4"
|
| 34 |
+
clip.write_videofile(video_path, fps=24)
|
| 35 |
+
return video_path
|
| 36 |
+
|
| 37 |
+
with gr.Blocks() as demo:
|
| 38 |
+
gr.Markdown("# Gouda — AI Multimedia Studio")
|
| 39 |
+
with gr.Tab("Text to Speech"):
|
| 40 |
+
txt = gr.Textbox(label="Enter text")
|
| 41 |
+
btn1 = gr.Button("Generate Voice (pyttsx3)")
|
| 42 |
+
btn2 = gr.Button("Generate Voice (gTTS)")
|
| 43 |
+
out1 = gr.Audio()
|
| 44 |
+
out2 = gr.Audio()
|
| 45 |
+
btn1.click(tts_pyttsx3, txt, out1)
|
| 46 |
+
btn2.click(tts_gtts, txt, out2)
|
| 47 |
+
with gr.Tab("Generate Image"):
|
| 48 |
+
prompt = gr.Textbox(label="Image Prompt")
|
| 49 |
+
img_btn = gr.Button("Generate Image")
|
| 50 |
+
img_out = gr.Image()
|
| 51 |
+
img_btn.click(generate_image, prompt, img_out)
|
| 52 |
+
with gr.Tab("Generate Video"):
|
| 53 |
+
text = gr.Textbox(label="Narration")
|
| 54 |
+
vprompt = gr.Textbox(label="Visual Prompt")
|
| 55 |
+
v_btn = gr.Button("Generate Video")
|
| 56 |
+
video_out = gr.Video()
|
| 57 |
+
v_btn.click(generate_video, [text, vprompt], video_out)
|
| 58 |
+
|
| 59 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.25.0
|
| 2 |
+
transformers
|
| 3 |
+
torch
|
| 4 |
+
diffusers
|
| 5 |
+
sentencepiece
|
| 6 |
+
opencv-python
|
| 7 |
+
Pillow
|
| 8 |
+
pyttsx3
|
| 9 |
+
gtts
|
| 10 |
+
moviepy
|
| 11 |
+
numpy
|