File size: 1,041 Bytes
86bfa3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60a6ec5
9130d3b
 
86bfa3b
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
from tok2text import extract_recipe

def process_tiktok_url(tiktok_url):
    try:
        formatted_recipe, formatted_recipe_path, transcript_path = extract_recipe(tiktok_url)
        return formatted_recipe, str(formatted_recipe_path), str(transcript_path)
    except Exception as e:
        return f"Error: {str(e)}", None

demo = gr.Interface(
    fn=process_tiktok_url,
    inputs=gr.Textbox(label="TikTok URL"),
    outputs=[
        gr.Textbox(label="Formatted Recipe"),
        gr.File(label="Download Formatted Recipe"),
        gr.File(label="Download Raw Transcript"),
    ],
    title="TikTok Recipe Extractor",
    description="Extract and format recipes from TikTok videos.",
    examples=[
        ["https://www.tiktok.com/@emmaaaaaaam_/video/7348493781961886981"],
        ["https://www.tiktok.com/@vanessacooks_/video/7280652972567170346"],
        ["https://www.tiktok.com/@freddsters/video/7027220930124451078?lang=en"]
    ],
    allow_flagging="never"
)



if __name__ == "__main__":
    demo.launch()