File size: 637 Bytes
aaf306d
 
919e56b
aaf306d
 
 
 
 
 
 
919e56b
 
 
aaf306d
 
 
 
 
 
919e56b
 
aaf306d
 
 
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
import gradio as gr
import subprocess
import os

def run_katana(url):
    output_file = "urls.txt"
    command = f"katana -u {url} > {output_file}"
    subprocess.run(command, shell=True, check=True)
    return output_file

# Ensure the /tmp/flagged directory exists
os.makedirs("/tmp/flagged", exist_ok=True)

# Gradio interface
interface = gr.Interface(
    fn=run_katana,
    inputs="text",
    outputs="file",
    title="Katana URL Crawler",
    description="Enter a URL to crawl with Katana.",
    flagging_dir="/tmp/flagged"  # Specify a writable directory for flagging
)

interface.launch(server_name="0.0.0.0", server_port=7860)