userIdc2024 commited on
Commit
2d2e74c
·
verified ·
1 Parent(s): d9b767c

Delete caption_gen.py

Browse files
Files changed (1) hide show
  1. caption_gen.py +0 -42
caption_gen.py DELETED
@@ -1,42 +0,0 @@
1
- import os
2
- import replicate
3
-
4
- from dotenv import load_dotenv
5
-
6
-
7
- load_dotenv()
8
- replicate_client = replicate.Client(api_token= os.getenv("REPLICATE_API_KEY"))
9
-
10
- def caption_generation(
11
- video: bytes,
12
- caption_size: int,
13
- highlight_color: str):
14
- output = replicate_client.run(
15
- "shreejalmaharjan-27/tiktok-short-captions:46bf1c12c77ad1782d6f87828d4d8ba4d48646b8e1271b490cb9e95ccdbc4504",
16
- input={
17
- "model": "large-v3",
18
- "video": f"data:video/mp4;base64,{video}",
19
- "language": "auto",
20
- "temperature": 0,
21
- "caption_size": caption_size,
22
- "highlight_color": highlight_color,
23
- "suppress_tokens": "-1",
24
- "logprob_threshold": -1,
25
- "no_speech_threshold": 0.6,
26
- "condition_on_previous_text": True,
27
- "compression_ratio_threshold": 2.4,
28
- "temperature_increment_on_fallback": 0.2
29
- }
30
- )
31
-
32
- urls = []
33
- if isinstance(output, list) and output:
34
- first = output[0]
35
- url = getattr(first, "url", str(first))
36
- urls = [url]
37
- elif isinstance(output, str):
38
- urls = [output]
39
- elif hasattr(output, "url"):
40
- urls = [getattr(output, "url")]
41
- if urls:
42
- return urls[0]