Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,11 +80,12 @@ def load_model():
|
|
80 |
|
81 |
model, tokenizer = load_model()
|
82 |
|
83 |
-
def analyze_dna(
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
|
89 |
try:
|
90 |
if not all(nucleotide in 'ACTGN' for nucleotide in sequence):
|
@@ -105,7 +106,7 @@ def analyze_dna(sequence, password):
|
|
105 |
fig, ax = plt.subplots(figsize=(10, 6))
|
106 |
ax.barh(top_5_labels, top_5_probs, color='skyblue')
|
107 |
ax.set_xlabel('Probability')
|
108 |
-
ax.set_title('Top 5 Most Likely
|
109 |
plt.gca().invert_yaxis()
|
110 |
|
111 |
buf = io.BytesIO()
|
@@ -122,7 +123,11 @@ def analyze_dna(sequence, password):
|
|
122 |
# Create a Gradio interface
|
123 |
demo = gr.Interface(
|
124 |
fn=analyze_dna,
|
125 |
-
inputs=[
|
|
|
|
|
|
|
|
|
126 |
outputs=["json", "html"]
|
127 |
)
|
128 |
|
|
|
80 |
|
81 |
model, tokenizer = load_model()
|
82 |
|
83 |
+
def analyze_dna(username, password, sequence):
|
84 |
+
env_username = os.getenv('USERNAME')
|
85 |
+
env_password = os.getenv('PASSWORD')
|
86 |
+
|
87 |
+
if username != env_username or password != env_password:
|
88 |
+
return {"error": "Invalid username or password"}, ""
|
89 |
|
90 |
try:
|
91 |
if not all(nucleotide in 'ACTGN' for nucleotide in sequence):
|
|
|
106 |
fig, ax = plt.subplots(figsize=(10, 6))
|
107 |
ax.barh(top_5_labels, top_5_probs, color='skyblue')
|
108 |
ax.set_xlabel('Probability')
|
109 |
+
ax.set_title('Top 5 Most Likely Labels')
|
110 |
plt.gca().invert_yaxis()
|
111 |
|
112 |
buf = io.BytesIO()
|
|
|
123 |
# Create a Gradio interface
|
124 |
demo = gr.Interface(
|
125 |
fn=analyze_dna,
|
126 |
+
inputs=[
|
127 |
+
gr.Textbox(label="Username"),
|
128 |
+
gr.Textbox(label="Password", type="password"),
|
129 |
+
gr.Textbox(label="DNA Sequence")
|
130 |
+
],
|
131 |
outputs=["json", "html"]
|
132 |
)
|
133 |
|