reel2meal / app.py
jacklangerman's picture
prepare app
86bfa3b
raw
history blame
931 Bytes
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/t/ZTLjYBSpt/"],
["https://www.tiktok.com/@emmaaaaaaam_/video/7348493781961886981"]
],
allow_flagging="never"
)
if __name__ == "__main__":
demo.launch()