Skip to content

Commit d34e40d

Browse files
Merge pull request #85 from LohiyaH/fix-issue-84
feat/docs: 📦 Updated README with full directory structure for…
2 parents 10764a9 + 551fada commit d34e40d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+11993
-0
lines changed

AI_Video-Gen/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Harsh Lohiya
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
1. The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
2. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

AI_Video-Gen/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# VidCraft
2+
3+
## Description
4+
This backend application is built using FastAPI and is designed to generate videos based on user-defined topics and backgrounds. It integrates multiple AI services for text generation, audio synthesis, image creation, and subtitle generation. The application handles various tasks, including cleaning text, formatting subtitles, and generating video files using FFmpeg.
5+
6+
## Project Overview
7+
This project is aimed at generating videos using AI technologies. It leverages advanced algorithms to create high-quality video content based on user inputs.
8+
9+
## Frontend Description
10+
The frontend of this project is built using modern web technologies including React.js for a dynamic user experience. The interface is designed to be intuitive, allowing users to easily input their preferences and view the generated videos. Key features include:
11+
- **Responsive Design**: The application is fully responsive, ensuring a seamless experience on both desktop and mobile devices.
12+
- **Real-time Preview**: Users can see a real-time preview of their video as they adjust settings.
13+
- **User-Friendly Interface**: The layout is clean and organized, making navigation simple.
14+
15+
## Installation Instructions
16+
### Backend Installation
17+
1. Clone the repository:
18+
```bash
19+
git clone https://github.com/LohiyaH/VidCraft
20+
cd shorty
21+
```
22+
2. Install the required dependencies:
23+
```bash
24+
pip install -r backend/requirements.txt
25+
```
26+
3. Set up environment variables in a `.env` file:
27+
```
28+
GEMINI_API_KEY=<your-gemini-api-key>
29+
ELEVENLABS_API_KEY=<your-elevenlabs-api-key>
30+
HUGGINGFACE_API_KEY=<your-huggingface-api-key>
31+
```
32+
33+
### Frontend Installation
34+
To set up the frontend, follow these steps:
35+
1. Navigate to the frontend directory: `cd frontend`
36+
2. Install dependencies: `npm install`
37+
3. Start the application: `npm start`
38+
39+
## Usage
40+
### Backend Usage
41+
1. Run the FastAPI application:
42+
```bash
43+
uvicorn backend.main:app --reload
44+
```
45+
2. Access the API documentation at `http://localhost:8000/docs`.
46+
47+
### Frontend Usage
48+
Once the application is running, users can input their video preferences in the provided fields and click on the 'Generate Video' button to create their AI-generated video. The results will be displayed in the preview section.
49+
50+
## API Endpoints
51+
- **POST** `/api/generate-video`
52+
- **Request Body**:
53+
```json
54+
{
55+
"topic": "string",
56+
"background": "string"
57+
}
58+
```
59+
- **Response**:
60+
```json
61+
{
62+
"videoUrl": "string"
63+
}
64+
```
65+
66+
- **GET** `/api/test`
67+
- Returns a simple test message.
68+
69+
[Watch the video](https://drive.google.com/file/d/1WjUGrYiH2_ghVuXiveTgCI0QvJksH7Dc/view?usp=sharing)
70+
71+
## Contributing
72+
Contributions are welcome! Please open an issue or submit a pull request.
73+
74+
## License
75+
This project is licensed under the MIT License.

AI_Video-Gen/backend

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 8c98a12b0ca5034832ba096f3351a675d64ff2f7

AI_Video-Gen/frontend/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_API_URL=http://localhost:8000
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

AI_Video-Gen/frontend/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts
36+
37+
.vercel
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
:root {
6+
--foreground-rgb: 0, 0, 0;
7+
--background-start-rgb: 214, 219, 220;
8+
--background-end-rgb: 255, 255, 255;
9+
}
10+
11+
@media (prefers-color-scheme: dark) {
12+
:root {
13+
--foreground-rgb: 255, 255, 255;
14+
--background-start-rgb: 0, 0, 0;
15+
--background-end-rgb: 0, 0, 0;
16+
}
17+
}
18+
19+
@layer base {
20+
:root {
21+
--background: 0 0% 100%;
22+
--foreground: 0 0% 3.9%;
23+
--card: 0 0% 100%;
24+
--card-foreground: 0 0% 3.9%;
25+
--popover: 0 0% 100%;
26+
--popover-foreground: 0 0% 3.9%;
27+
--primary: 0 0% 9%;
28+
--primary-foreground: 0 0% 98%;
29+
--secondary: 0 0% 96.1%;
30+
--secondary-foreground: 0 0% 9%;
31+
--muted: 0 0% 96.1%;
32+
--muted-foreground: 0 0% 45.1%;
33+
--accent: 0 0% 96.1%;
34+
--accent-foreground: 0 0% 9%;
35+
--destructive: 0 84.2% 60.2%;
36+
--destructive-foreground: 0 0% 98%;
37+
--border: 0 0% 89.8%;
38+
--input: 0 0% 89.8%;
39+
--ring: 0 0% 3.9%;
40+
--chart-1: 12 76% 61%;
41+
--chart-2: 173 58% 39%;
42+
--chart-3: 197 37% 24%;
43+
--chart-4: 43 74% 66%;
44+
--chart-5: 27 87% 67%;
45+
--radius: 0.5rem;
46+
}
47+
.dark {
48+
--background: 0 0% 3.9%;
49+
--foreground: 0 0% 98%;
50+
--card: 0 0% 3.9%;
51+
--card-foreground: 0 0% 98%;
52+
--popover: 0 0% 3.9%;
53+
--popover-foreground: 0 0% 98%;
54+
--primary: 0 0% 98%;
55+
--primary-foreground: 0 0% 9%;
56+
--secondary: 0 0% 14.9%;
57+
--secondary-foreground: 0 0% 98%;
58+
--muted: 0 0% 14.9%;
59+
--muted-foreground: 0 0% 63.9%;
60+
--accent: 0 0% 14.9%;
61+
--accent-foreground: 0 0% 98%;
62+
--destructive: 0 62.8% 30.6%;
63+
--destructive-foreground: 0 0% 98%;
64+
--border: 0 0% 14.9%;
65+
--input: 0 0% 14.9%;
66+
--ring: 0 0% 83.1%;
67+
--chart-1: 220 70% 50%;
68+
--chart-2: 160 60% 45%;
69+
--chart-3: 30 80% 55%;
70+
--chart-4: 280 65% 60%;
71+
--chart-5: 340 75% 55%;
72+
}
73+
}
74+
75+
@layer base {
76+
* {
77+
@apply border-border;
78+
}
79+
body {
80+
@apply bg-background text-foreground;
81+
}
82+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import './globals.css';
2+
import type { Metadata } from 'next';
3+
import { Inter } from 'next/font/google';
4+
5+
const inter = Inter({ subsets: ['latin'] });
6+
7+
export const metadata: Metadata = {
8+
title: 'Create Next App',
9+
description: 'Generated by create next app',
10+
};
11+
12+
export default function RootLayout({
13+
children,
14+
}: {
15+
children: React.ReactNode;
16+
}) {
17+
return (
18+
<html lang="en">
19+
<body className={inter.className}>{children}</body>
20+
</html>
21+
);
22+
}

AI_Video-Gen/frontend/app/page.tsx

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
"use client";
2+
3+
import { useState } from "react";
4+
import { Button } from "@/components/ui/button";
5+
import { Input } from "@/components/ui/input";
6+
import { Textarea } from "@/components/ui/textarea";
7+
import { Card } from "@/components/ui/card";
8+
import { VideoIcon, Download, Loader2 } from "lucide-react";
9+
import { useToast } from "@/hooks/use-toast";
10+
11+
export default function Home() {
12+
const [topic, setTopic] = useState("");
13+
const [background, setBackground] = useState("");
14+
const [loading, setLoading] = useState(false);
15+
const [videoUrl, setVideoUrl] = useState<string | null>(null);
16+
const { toast } = useToast();
17+
18+
const handleSubmit = async (e: React.FormEvent) => {
19+
e.preventDefault();
20+
setLoading(true);
21+
22+
try {
23+
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/generate-video`, {
24+
method: "POST",
25+
headers: {
26+
"Content-Type": "application/json",
27+
},
28+
body: JSON.stringify({ topic, background }),
29+
});
30+
31+
if (!response.ok) {
32+
throw new Error("Failed to generate video");
33+
}
34+
35+
const data = await response.json();
36+
setVideoUrl(data.videoUrl);
37+
toast({
38+
title: "Success!",
39+
description: "Your video has been generated successfully.",
40+
});
41+
} catch (error) {
42+
toast({
43+
variant: "destructive",
44+
title: "Error",
45+
description: "Failed to generate video. Please try again.",
46+
});
47+
} finally {
48+
setLoading(false);
49+
}
50+
};
51+
52+
return (
53+
<main className="min-h-screen bg-gradient-to-b from-background to-muted">
54+
<div className="container max-w-4xl mx-auto px-4 py-16">
55+
<div className="space-y-8">
56+
<div className="text-center space-y-4">
57+
<h1 className="text-4xl font-bold tracking-tight">AI Video Generator</h1>
58+
<p className="text-muted-foreground text-lg">
59+
Transform your ideas into engaging videos with the power of AI
60+
</p>
61+
</div>
62+
63+
<Card className="p-6">
64+
<form onSubmit={handleSubmit} className="space-y-6">
65+
<div className="space-y-2">
66+
<label htmlFor="topic" className="text-sm font-medium">
67+
Video Topic
68+
</label>
69+
<Input
70+
id="topic"
71+
placeholder="Enter your video topic"
72+
value={topic}
73+
onChange={(e) => setTopic(e.target.value)}
74+
required
75+
/>
76+
</div>
77+
78+
<div className="space-y-2">
79+
<label htmlFor="background" className="text-sm font-medium">
80+
Background Description
81+
</label>
82+
<Textarea
83+
id="background"
84+
placeholder="Describe the desired background for your video"
85+
value={background}
86+
onChange={(e) => setBackground(e.target.value)}
87+
required
88+
className="min-h-[100px]"
89+
/>
90+
</div>
91+
92+
<Button
93+
type="submit"
94+
className="w-full"
95+
disabled={loading}
96+
size="lg"
97+
>
98+
{loading ? (
99+
<>
100+
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
101+
Generating Video...
102+
</>
103+
) : (
104+
<>
105+
<VideoIcon className="mr-2 h-4 w-4" />
106+
Generate Video
107+
</>
108+
)}
109+
</Button>
110+
</form>
111+
</Card>
112+
113+
{videoUrl && (
114+
<Card className="p-6 space-y-4">
115+
<h2 className="text-xl font-semibold">Generated Video</h2>
116+
<div className="aspect-video bg-muted rounded-lg overflow-hidden">
117+
<video
118+
src={videoUrl}
119+
controls
120+
className="w-full h-full object-contain"
121+
/>
122+
</div>
123+
<Button
124+
variant="outline"
125+
className="w-full"
126+
onClick={() => window.open(videoUrl, "_blank")}
127+
>
128+
<Download className="mr-2 h-4 w-4" />
129+
Download Video
130+
</Button>
131+
</Card>
132+
)}
133+
</div>
134+
</div>
135+
</main>
136+
);
137+
}

0 commit comments

Comments
 (0)