Oranblock commited on
Commit
b4b1e6b
1 Parent(s): 1ac9747

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -24,15 +24,10 @@ def analyze_and_fix_shell_script(script_content):
24
 
25
  # Gradio interface to upload shell script and process
26
  def upload_and_fix(file):
27
- # Check if file is a NamedString or IO type object and handle it accordingly
28
- if isinstance(file, (bytes, str)):
29
- # Decode the content if it's in byte/string format
30
- script_content = file.decode("utf-8")
31
- else:
32
- # Otherwise, it's already a string
33
- script_content = file
34
 
35
- # Analyze and fix the shell script using GPT
36
  fixed_script = analyze_and_fix_shell_script(script_content)
37
 
38
  return fixed_script
 
24
 
25
  # Gradio interface to upload shell script and process
26
  def upload_and_fix(file):
27
+ # Handle both string and byte file formats
28
+ script_content = file if isinstance(file, str) else file.decode("utf-8")
 
 
 
 
 
29
 
30
+ # Call the GPT model to analyze and fix the shell script
31
  fixed_script = analyze_and_fix_shell_script(script_content)
32
 
33
  return fixed_script