fabioantonini commited on
Commit
7e4ef99
·
verified ·
1 Parent(s): 7753922

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -13
app.py CHANGED
@@ -45,19 +45,8 @@ def process_file(pcap_file):
45
  if not pcap_file:
46
  return "No file uploaded.", {}
47
 
48
- # In newer Gradio versions, pcap_file is a dict:
49
- # {
50
- # "name": "path or random name",
51
- # "orig_name": "original_filename.pcap",
52
- # "data": b"raw bytes of the file",
53
- # ...
54
- # }
55
- temp_filename = pcap_file["name"]
56
- raw_data = pcap_file["data"]
57
-
58
- # Write the file bytes to disk
59
- with open(temp_filename, "wb") as f:
60
- f.write(raw_data)
61
 
62
  # 1) Parse the PCAP
63
  calls_by_id = parse_pcap(temp_filename)
 
45
  if not pcap_file:
46
  return "No file uploaded.", {}
47
 
48
+ # pcap_file is a string path to the temp file, e.g. "/tmp/gradio/xyz/somefile.pcap"
49
+ temp_filename = pcap_file
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  # 1) Parse the PCAP
52
  calls_by_id = parse_pcap(temp_filename)