Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
Simple Video Editor - Canvas ๊ธฐ๋ฐ ๋ ๋๋ง
|
| 3 |
๋น ํ๋ ์ ๋ฌธ์ ์์ ํด๊ฒฐ + ์๋ฒ ์ฌ์ด๋ MP4 ๋ด๋ณด๋ด๊ธฐ
|
| 4 |
๋ธ๋ฌ ๋ฐฐ๊ฒฝ ๋ด๋ณด๋ด๊ธฐ ์์ : ๋๋ธ ๋ฒํผ๋ง
|
|
|
|
| 5 |
"""
|
| 6 |
|
| 7 |
import gradio as gr
|
|
@@ -1435,10 +1436,341 @@ def convert_webm_to_mp4(webm_base64):
|
|
| 1435 |
print(f"[Convert] Error: {e}")
|
| 1436 |
return None
|
| 1437 |
|
| 1438 |
-
|
| 1439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1440 |
|
| 1441 |
-
f = gr.File(label="๐ ํ์ผ ์
๋ก๋", file_count="multiple", file_types=["video", "image", "audio"])
|
| 1442 |
e = gr.HTML(value=make_iframe([]))
|
| 1443 |
|
| 1444 |
gr.Markdown("---")
|
|
|
|
| 2 |
Simple Video Editor - Canvas ๊ธฐ๋ฐ ๋ ๋๋ง
|
| 3 |
๋น ํ๋ ์ ๋ฌธ์ ์์ ํด๊ฒฐ + ์๋ฒ ์ฌ์ด๋ MP4 ๋ด๋ณด๋ด๊ธฐ
|
| 4 |
๋ธ๋ฌ ๋ฐฐ๊ฒฝ ๋ด๋ณด๋ด๊ธฐ ์์ : ๋๋ธ ๋ฒํผ๋ง
|
| 5 |
+
๐จ Comic Classic Theme ์ ์ฉ
|
| 6 |
"""
|
| 7 |
|
| 8 |
import gradio as gr
|
|
|
|
| 1436 |
print(f"[Convert] Error: {e}")
|
| 1437 |
return None
|
| 1438 |
|
| 1439 |
+
|
| 1440 |
+
# ============================================
|
| 1441 |
+
# ๐จ Comic Classic Theme CSS
|
| 1442 |
+
# ============================================
|
| 1443 |
+
|
| 1444 |
+
css = """
|
| 1445 |
+
/* ===== ๐จ Google Fonts Import ===== */
|
| 1446 |
+
@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Comic+Neue:wght@400;700&display=swap');
|
| 1447 |
+
|
| 1448 |
+
/* ===== ๐จ Comic Classic Background ===== */
|
| 1449 |
+
.gradio-container {
|
| 1450 |
+
background-color: #FEF9C3 !important;
|
| 1451 |
+
background-image:
|
| 1452 |
+
radial-gradient(#1F2937 1px, transparent 1px) !important;
|
| 1453 |
+
background-size: 20px 20px !important;
|
| 1454 |
+
min-height: 100vh !important;
|
| 1455 |
+
font-family: 'Comic Neue', cursive, sans-serif !important;
|
| 1456 |
+
}
|
| 1457 |
+
|
| 1458 |
+
/* ===== Hide HuggingFace Elements ===== */
|
| 1459 |
+
.huggingface-space-header,
|
| 1460 |
+
#space-header,
|
| 1461 |
+
.space-header,
|
| 1462 |
+
[class*="space-header"],
|
| 1463 |
+
.svelte-1ed2p3z,
|
| 1464 |
+
.space-header-badge,
|
| 1465 |
+
.header-badge,
|
| 1466 |
+
[data-testid="space-header"],
|
| 1467 |
+
.svelte-kqij2n,
|
| 1468 |
+
.svelte-1ax1toq,
|
| 1469 |
+
.embed-container > div:first-child {
|
| 1470 |
+
display: none !important;
|
| 1471 |
+
visibility: hidden !important;
|
| 1472 |
+
height: 0 !important;
|
| 1473 |
+
width: 0 !important;
|
| 1474 |
+
overflow: hidden !important;
|
| 1475 |
+
opacity: 0 !important;
|
| 1476 |
+
pointer-events: none !important;
|
| 1477 |
+
}
|
| 1478 |
+
|
| 1479 |
+
/* ===== Hide Footer ===== */
|
| 1480 |
+
footer,
|
| 1481 |
+
.footer,
|
| 1482 |
+
.gradio-container footer,
|
| 1483 |
+
.built-with,
|
| 1484 |
+
[class*="footer"],
|
| 1485 |
+
.gradio-footer,
|
| 1486 |
+
.main-footer,
|
| 1487 |
+
div[class*="footer"],
|
| 1488 |
+
.show-api,
|
| 1489 |
+
.built-with-gradio,
|
| 1490 |
+
a[href*="gradio.app"],
|
| 1491 |
+
a[href*="huggingface.co/spaces"] {
|
| 1492 |
+
display: none !important;
|
| 1493 |
+
visibility: hidden !important;
|
| 1494 |
+
height: 0 !important;
|
| 1495 |
+
padding: 0 !important;
|
| 1496 |
+
margin: 0 !important;
|
| 1497 |
+
}
|
| 1498 |
+
|
| 1499 |
+
/* ===== Main Container ===== */
|
| 1500 |
+
#col-container {
|
| 1501 |
+
max-width: 1200px;
|
| 1502 |
+
margin: 0 auto;
|
| 1503 |
+
}
|
| 1504 |
+
|
| 1505 |
+
/* ===== ๐จ Header Title - Comic Style ===== */
|
| 1506 |
+
.header-text h1 {
|
| 1507 |
+
font-family: 'Bangers', cursive !important;
|
| 1508 |
+
color: #1F2937 !important;
|
| 1509 |
+
font-size: 3.5rem !important;
|
| 1510 |
+
font-weight: 400 !important;
|
| 1511 |
+
text-align: center !important;
|
| 1512 |
+
margin-bottom: 0.5rem !important;
|
| 1513 |
+
text-shadow:
|
| 1514 |
+
4px 4px 0px #FACC15,
|
| 1515 |
+
6px 6px 0px #1F2937 !important;
|
| 1516 |
+
letter-spacing: 3px !important;
|
| 1517 |
+
-webkit-text-stroke: 2px #1F2937 !important;
|
| 1518 |
+
}
|
| 1519 |
+
|
| 1520 |
+
/* ===== ๐จ Subtitle ===== */
|
| 1521 |
+
.subtitle {
|
| 1522 |
+
text-align: center !important;
|
| 1523 |
+
font-family: 'Comic Neue', cursive !important;
|
| 1524 |
+
font-size: 1.2rem !important;
|
| 1525 |
+
color: #1F2937 !important;
|
| 1526 |
+
margin-bottom: 1.5rem !important;
|
| 1527 |
+
font-weight: 700 !important;
|
| 1528 |
+
}
|
| 1529 |
+
|
| 1530 |
+
/* ===== ๐จ Cards/Panels - Comic Frame Style ===== */
|
| 1531 |
+
.gr-panel,
|
| 1532 |
+
.gr-box,
|
| 1533 |
+
.gr-form,
|
| 1534 |
+
.block,
|
| 1535 |
+
.gr-group {
|
| 1536 |
+
background: #FFFFFF !important;
|
| 1537 |
+
border: 3px solid #1F2937 !important;
|
| 1538 |
+
border-radius: 8px !important;
|
| 1539 |
+
box-shadow: 6px 6px 0px #1F2937 !important;
|
| 1540 |
+
transition: all 0.2s ease !important;
|
| 1541 |
+
}
|
| 1542 |
+
|
| 1543 |
+
.gr-panel:hover,
|
| 1544 |
+
.block:hover {
|
| 1545 |
+
transform: translate(-2px, -2px) !important;
|
| 1546 |
+
box-shadow: 8px 8px 0px #1F2937 !important;
|
| 1547 |
+
}
|
| 1548 |
+
|
| 1549 |
+
/* ===== ๐จ Input Fields ===== */
|
| 1550 |
+
textarea,
|
| 1551 |
+
input[type="text"],
|
| 1552 |
+
input[type="number"] {
|
| 1553 |
+
background: #FFFFFF !important;
|
| 1554 |
+
border: 3px solid #1F2937 !important;
|
| 1555 |
+
border-radius: 8px !important;
|
| 1556 |
+
color: #1F2937 !important;
|
| 1557 |
+
font-family: 'Comic Neue', cursive !important;
|
| 1558 |
+
font-size: 1rem !important;
|
| 1559 |
+
font-weight: 700 !important;
|
| 1560 |
+
transition: all 0.2s ease !important;
|
| 1561 |
+
}
|
| 1562 |
+
|
| 1563 |
+
textarea:focus,
|
| 1564 |
+
input[type="text"]:focus,
|
| 1565 |
+
input[type="number"]:focus {
|
| 1566 |
+
border-color: #3B82F6 !important;
|
| 1567 |
+
box-shadow: 4px 4px 0px #3B82F6 !important;
|
| 1568 |
+
outline: none !important;
|
| 1569 |
+
}
|
| 1570 |
+
|
| 1571 |
+
textarea::placeholder {
|
| 1572 |
+
color: #9CA3AF !important;
|
| 1573 |
+
font-weight: 400 !important;
|
| 1574 |
+
}
|
| 1575 |
+
|
| 1576 |
+
/* ===== ๐จ Primary Button - Comic Blue ===== */
|
| 1577 |
+
.gr-button-primary,
|
| 1578 |
+
button.primary,
|
| 1579 |
+
.gr-button.primary {
|
| 1580 |
+
background: #3B82F6 !important;
|
| 1581 |
+
border: 3px solid #1F2937 !important;
|
| 1582 |
+
border-radius: 8px !important;
|
| 1583 |
+
color: #FFFFFF !important;
|
| 1584 |
+
font-family: 'Bangers', cursive !important;
|
| 1585 |
+
font-weight: 400 !important;
|
| 1586 |
+
font-size: 1.3rem !important;
|
| 1587 |
+
letter-spacing: 2px !important;
|
| 1588 |
+
padding: 14px 28px !important;
|
| 1589 |
+
box-shadow: 5px 5px 0px #1F2937 !important;
|
| 1590 |
+
transition: all 0.1s ease !important;
|
| 1591 |
+
text-shadow: 1px 1px 0px #1F2937 !important;
|
| 1592 |
+
}
|
| 1593 |
+
|
| 1594 |
+
.gr-button-primary:hover,
|
| 1595 |
+
button.primary:hover,
|
| 1596 |
+
.gr-button.primary:hover {
|
| 1597 |
+
background: #2563EB !important;
|
| 1598 |
+
transform: translate(-2px, -2px) !important;
|
| 1599 |
+
box-shadow: 7px 7px 0px #1F2937 !important;
|
| 1600 |
+
}
|
| 1601 |
+
|
| 1602 |
+
.gr-button-primary:active,
|
| 1603 |
+
button.primary:active,
|
| 1604 |
+
.gr-button.primary:active {
|
| 1605 |
+
transform: translate(3px, 3px) !important;
|
| 1606 |
+
box-shadow: 2px 2px 0px #1F2937 !important;
|
| 1607 |
+
}
|
| 1608 |
+
|
| 1609 |
+
/* ===== ๐จ Secondary Button - Comic Red ===== */
|
| 1610 |
+
.gr-button-secondary,
|
| 1611 |
+
button.secondary {
|
| 1612 |
+
background: #EF4444 !important;
|
| 1613 |
+
border: 3px solid #1F2937 !important;
|
| 1614 |
+
border-radius: 8px !important;
|
| 1615 |
+
color: #FFFFFF !important;
|
| 1616 |
+
font-family: 'Bangers', cursive !important;
|
| 1617 |
+
font-weight: 400 !important;
|
| 1618 |
+
font-size: 1.1rem !important;
|
| 1619 |
+
letter-spacing: 1px !important;
|
| 1620 |
+
box-shadow: 4px 4px 0px #1F2937 !important;
|
| 1621 |
+
transition: all 0.1s ease !important;
|
| 1622 |
+
text-shadow: 1px 1px 0px #1F2937 !important;
|
| 1623 |
+
}
|
| 1624 |
+
|
| 1625 |
+
.gr-button-secondary:hover,
|
| 1626 |
+
button.secondary:hover {
|
| 1627 |
+
background: #DC2626 !important;
|
| 1628 |
+
transform: translate(-2px, -2px) !important;
|
| 1629 |
+
box-shadow: 6px 6px 0px #1F2937 !important;
|
| 1630 |
+
}
|
| 1631 |
+
|
| 1632 |
+
.gr-button-secondary:active,
|
| 1633 |
+
button.secondary:active {
|
| 1634 |
+
transform: translate(2px, 2px) !important;
|
| 1635 |
+
box-shadow: 2px 2px 0px #1F2937 !important;
|
| 1636 |
+
}
|
| 1637 |
+
|
| 1638 |
+
/* ===== ๐จ Labels ===== */
|
| 1639 |
+
label,
|
| 1640 |
+
.gr-input-label,
|
| 1641 |
+
.gr-block-label {
|
| 1642 |
+
color: #1F2937 !important;
|
| 1643 |
+
font-family: 'Comic Neue', cursive !important;
|
| 1644 |
+
font-weight: 700 !important;
|
| 1645 |
+
font-size: 1rem !important;
|
| 1646 |
+
}
|
| 1647 |
+
|
| 1648 |
+
span.gr-label {
|
| 1649 |
+
color: #1F2937 !important;
|
| 1650 |
+
}
|
| 1651 |
+
|
| 1652 |
+
/* ===== ๐จ File Upload Area ===== */
|
| 1653 |
+
.gr-file-upload {
|
| 1654 |
+
border: 3px dashed #1F2937 !important;
|
| 1655 |
+
border-radius: 8px !important;
|
| 1656 |
+
background: #FEF9C3 !important;
|
| 1657 |
+
}
|
| 1658 |
+
|
| 1659 |
+
.gr-file-upload:hover {
|
| 1660 |
+
border-color: #3B82F6 !important;
|
| 1661 |
+
background: #EFF6FF !important;
|
| 1662 |
+
}
|
| 1663 |
+
|
| 1664 |
+
/* ===== ๐จ Scrollbar - Comic Style ===== */
|
| 1665 |
+
::-webkit-scrollbar {
|
| 1666 |
+
width: 12px;
|
| 1667 |
+
height: 12px;
|
| 1668 |
+
}
|
| 1669 |
+
|
| 1670 |
+
::-webkit-scrollbar-track {
|
| 1671 |
+
background: #FEF9C3;
|
| 1672 |
+
border: 2px solid #1F2937;
|
| 1673 |
+
}
|
| 1674 |
+
|
| 1675 |
+
::-webkit-scrollbar-thumb {
|
| 1676 |
+
background: #3B82F6;
|
| 1677 |
+
border: 2px solid #1F2937;
|
| 1678 |
+
border-radius: 0px;
|
| 1679 |
+
}
|
| 1680 |
+
|
| 1681 |
+
::-webkit-scrollbar-thumb:hover {
|
| 1682 |
+
background: #EF4444;
|
| 1683 |
+
}
|
| 1684 |
+
|
| 1685 |
+
/* ===== ๐จ Selection Highlight ===== */
|
| 1686 |
+
::selection {
|
| 1687 |
+
background: #FACC15;
|
| 1688 |
+
color: #1F2937;
|
| 1689 |
+
}
|
| 1690 |
+
|
| 1691 |
+
/* ===== ๐จ Links ===== */
|
| 1692 |
+
a {
|
| 1693 |
+
color: #3B82F6 !important;
|
| 1694 |
+
text-decoration: none !important;
|
| 1695 |
+
font-weight: 700 !important;
|
| 1696 |
+
}
|
| 1697 |
+
|
| 1698 |
+
a:hover {
|
| 1699 |
+
color: #EF4444 !important;
|
| 1700 |
+
}
|
| 1701 |
+
|
| 1702 |
+
/* ===== ๐จ Row/Column Spacing ===== */
|
| 1703 |
+
.gr-row {
|
| 1704 |
+
gap: 1.5rem !important;
|
| 1705 |
+
}
|
| 1706 |
+
|
| 1707 |
+
.gr-column {
|
| 1708 |
+
gap: 1rem !important;
|
| 1709 |
+
}
|
| 1710 |
+
|
| 1711 |
+
/* ===== Responsive Adjustments ===== */
|
| 1712 |
+
@media (max-width: 768px) {
|
| 1713 |
+
.header-text h1 {
|
| 1714 |
+
font-size: 2.2rem !important;
|
| 1715 |
+
text-shadow:
|
| 1716 |
+
3px 3px 0px #FACC15,
|
| 1717 |
+
4px 4px 0px #1F2937 !important;
|
| 1718 |
+
}
|
| 1719 |
+
|
| 1720 |
+
.gr-button-primary,
|
| 1721 |
+
button.primary {
|
| 1722 |
+
padding: 12px 20px !important;
|
| 1723 |
+
font-size: 1.1rem !important;
|
| 1724 |
+
}
|
| 1725 |
+
|
| 1726 |
+
.gr-panel,
|
| 1727 |
+
.block {
|
| 1728 |
+
box-shadow: 4px 4px 0px #1F2937 !important;
|
| 1729 |
+
}
|
| 1730 |
+
}
|
| 1731 |
+
|
| 1732 |
+
/* ===== ๐จ Disable Dark Mode ===== */
|
| 1733 |
+
@media (prefers-color-scheme: dark) {
|
| 1734 |
+
.gradio-container {
|
| 1735 |
+
background-color: #FEF9C3 !important;
|
| 1736 |
+
}
|
| 1737 |
+
}
|
| 1738 |
+
"""
|
| 1739 |
+
|
| 1740 |
+
|
| 1741 |
+
# ============================================
|
| 1742 |
+
# Gradio UI
|
| 1743 |
+
# ============================================
|
| 1744 |
+
|
| 1745 |
+
with gr.Blocks(title="Video Editor", css=css) as demo:
|
| 1746 |
+
|
| 1747 |
+
# Inject CSS via HTML (Audio Extractor์ ๋์ผํ ๋ฐฉ์)
|
| 1748 |
+
gr.HTML(f"<style>{css}</style>")
|
| 1749 |
+
|
| 1750 |
+
# HOME Badge (Audio Extractor์ ๋์ผํ ๋ฐฉ์)
|
| 1751 |
+
gr.HTML("""
|
| 1752 |
+
<div style="text-align: center; margin: 20px 0 10px 0;">
|
| 1753 |
+
<a href="https://www.humangen.ai" target="_blank" style="text-decoration: none;">
|
| 1754 |
+
<img src="https://img.shields.io/static/v1?label=๐ HOME&message=HUMANGEN.AI&color=0000ff&labelColor=ffcc00&style=for-the-badge" alt="HOME">
|
| 1755 |
+
</a>
|
| 1756 |
+
</div>
|
| 1757 |
+
""")
|
| 1758 |
+
|
| 1759 |
+
# Header Title
|
| 1760 |
+
gr.Markdown(
|
| 1761 |
+
"""
|
| 1762 |
+
# ๐ฌ VIDEO EDITOR ๐ฌ
|
| 1763 |
+
""",
|
| 1764 |
+
elem_classes="header-text"
|
| 1765 |
+
)
|
| 1766 |
+
|
| 1767 |
+
gr.Markdown(
|
| 1768 |
+
"""
|
| 1769 |
+
<p class="subtitle">โ๏ธ Edit your videos with timeline, effects & more! ๐ฅ</p>
|
| 1770 |
+
""",
|
| 1771 |
+
)
|
| 1772 |
|
| 1773 |
+
f = gr.File(label="๐ ํ์ผ ์
๋ก๋ (Video, Image, Audio)", file_count="multiple", file_types=["video", "image", "audio"])
|
| 1774 |
e = gr.HTML(value=make_iframe([]))
|
| 1775 |
|
| 1776 |
gr.Markdown("---")
|