Commit ·
f1ababa
verified ·
0
Parent(s):
initial commit
Browse files- .gitattributes +35 -0
- README.md +13 -0
- app.py +74 -0
- requirements.txt +2 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: New Space
|
| 3 |
+
emoji: 😻
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.41.1
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
short_description: vidposter
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This is a Gradio app that automates the creation of videos from text, images, or PDF files and posts them to social media accounts.
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import numpy as np
|
| 4 |
+
import pandas as pd
|
| 5 |
+
|
| 6 |
+
# Function to create a video from text
|
| 7 |
+
def create_video_from_text(text):
|
| 8 |
+
# Placeholder function to simulate video creation from text
|
| 9 |
+
return "video_from_text.mp4"
|
| 10 |
+
|
| 11 |
+
# Function to create a video from images
|
| 12 |
+
def create_video_from_images(images):
|
| 13 |
+
# Placeholder function to simulate video creation from images
|
| 14 |
+
return "video_from_images.mp4"
|
| 15 |
+
|
| 16 |
+
# Function to create a video from a PDF file
|
| 17 |
+
def create_video_from_pdf(pdf_file):
|
| 18 |
+
# Placeholder function to simulate video creation from a PDF file
|
| 19 |
+
return "video_from_pdf.mp4"
|
| 20 |
+
|
| 21 |
+
# Function to post a video to social media
|
| 22 |
+
def post_to_social_media(video, platform):
|
| 23 |
+
# Placeholder function to simulate posting to social media
|
| 24 |
+
return f"Posted {video} to {platform}"
|
| 25 |
+
|
| 26 |
+
# Main function to handle the entire process
|
| 27 |
+
def process_input(input_type, input_data, platform):
|
| 28 |
+
if input_type == "text":
|
| 29 |
+
video = create_video_from_text(input_data)
|
| 30 |
+
elif input_type == "images":
|
| 31 |
+
video = create_video_from_images(input_data)
|
| 32 |
+
elif input_type == "pdf":
|
| 33 |
+
video = create_video_from_pdf(input_data)
|
| 34 |
+
else:
|
| 35 |
+
return "Invalid input type"
|
| 36 |
+
|
| 37 |
+
post_result = post_to_social_media(video, platform)
|
| 38 |
+
return post_result
|
| 39 |
+
|
| 40 |
+
# Create the Gradio interface with a high contrast neon noir style
|
| 41 |
+
with gr.Blocks(css="body { background-color: #000; color: #0f0; } .gr-button { background-color: #f00; color: #000; } .gr-input { background-color: #000; color: #0f0; }") as demo:
|
| 42 |
+
gr.Markdown("# Social Media Automation App")
|
| 43 |
+
|
| 44 |
+
with gr.Row():
|
| 45 |
+
input_type = gr.Radio(["text", "images", "pdf"], label="Input Type")
|
| 46 |
+
|
| 47 |
+
with gr.Row():
|
| 48 |
+
text_input = gr.Textbox(label="Text Input", visible=False)
|
| 49 |
+
images_input = gr.File(label="Images Input", file_types=["image/*"], visible=False)
|
| 50 |
+
pdf_input = gr.File(label="PDF Input", file_types=["application/pdf"], visible=False)
|
| 51 |
+
|
| 52 |
+
with gr.Row():
|
| 53 |
+
platform = gr.Radio(["Facebook", "Twitter", "Instagram"], label="Social Media Platform")
|
| 54 |
+
|
| 55 |
+
with gr.Row():
|
| 56 |
+
submit_button = gr.Button("Submit")
|
| 57 |
+
|
| 58 |
+
output = gr.Textbox(label="Output")
|
| 59 |
+
|
| 60 |
+
# Function to update the visibility of input fields based on the selected input type
|
| 61 |
+
def update_input_visibility(input_type):
|
| 62 |
+
if input_type == "text":
|
| 63 |
+
return gr.Textbox.update(visible=True), gr.File.update(visible=False), gr.File.update(visible=False)
|
| 64 |
+
elif input_type == "images":
|
| 65 |
+
return gr.Textbox.update(visible=False), gr.File.update(visible=True), gr.File.update(visible=False)
|
| 66 |
+
elif input_type == "pdf":
|
| 67 |
+
return gr.Textbox.update(visible=False), gr.File.update(visible=False), gr.File.update(visible=True)
|
| 68 |
+
|
| 69 |
+
input_type.change(fn=update_input_visibility, inputs=input_type, outputs=[text_input, images_input, pdf_input])
|
| 70 |
+
|
| 71 |
+
submit_button.click(fn=process_input, inputs=[input_type, text_input, images_input, pdf_input, platform], outputs=output)
|
| 72 |
+
|
| 73 |
+
if __name__ == "__main__":
|
| 74 |
+
demo.launch(show_error=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy
|
| 2 |
+
pandas
|