Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -146,14 +146,9 @@ def predict(file_obj, top_kmers=10, fasta_text=""):
|
|
146 |
text = fasta_text.strip()
|
147 |
elif file_obj is not None:
|
148 |
try:
|
149 |
-
#
|
150 |
-
|
151 |
-
|
152 |
-
text = f.read()
|
153 |
-
elif isinstance(file_obj, str): # Already a string
|
154 |
-
text = file_obj
|
155 |
-
else: # Try reading as bytes
|
156 |
-
text = file_obj.read().decode('utf-8')
|
157 |
except Exception as e:
|
158 |
return f"Error reading file: {str(e)}\nPlease ensure you're uploading a valid FASTA text file.", None, None
|
159 |
else:
|
@@ -257,7 +252,7 @@ with gr.Blocks(css=css) as iface:
|
|
257 |
file_input = gr.File(
|
258 |
label="Upload FASTA file",
|
259 |
file_types=[".fasta", ".fa", ".txt"],
|
260 |
-
type="
|
261 |
)
|
262 |
text_input = gr.Textbox(
|
263 |
label="Or paste FASTA sequence",
|
|
|
146 |
text = fasta_text.strip()
|
147 |
elif file_obj is not None:
|
148 |
try:
|
149 |
+
# File input will be a filepath since we specified type="filepath"
|
150 |
+
with open(file_obj, 'r') as f:
|
151 |
+
text = f.read()
|
|
|
|
|
|
|
|
|
|
|
152 |
except Exception as e:
|
153 |
return f"Error reading file: {str(e)}\nPlease ensure you're uploading a valid FASTA text file.", None, None
|
154 |
else:
|
|
|
252 |
file_input = gr.File(
|
253 |
label="Upload FASTA file",
|
254 |
file_types=[".fasta", ".fa", ".txt"],
|
255 |
+
type="filepath" # Changed to filepath which is one of the valid options
|
256 |
)
|
257 |
text_input = gr.Textbox(
|
258 |
label="Or paste FASTA sequence",
|