Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -105,7 +105,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()
|
@@ -114,7 +114,7 @@ def analyze_dna(sequence, password):
|
|
114 |
image_base64 = base64.b64encode(buf.read()).decode('utf-8')
|
115 |
buf.close()
|
116 |
|
117 |
-
return f'<img src="data:image/png;base64,{image_base64}" />'
|
118 |
|
119 |
except Exception as e:
|
120 |
return {"error": str(e)}, ""
|
@@ -123,7 +123,7 @@ def analyze_dna(sequence, password):
|
|
123 |
demo = gr.Interface(
|
124 |
fn=analyze_dna,
|
125 |
inputs=[gr.Textbox(label="DNA Sequence"), gr.Textbox(label="Password", type="password")],
|
126 |
-
outputs=["html"]
|
127 |
)
|
128 |
|
129 |
# Launch the interface
|
|
|
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 Nations of Origin')
|
109 |
plt.gca().invert_yaxis()
|
110 |
|
111 |
buf = io.BytesIO()
|
|
|
114 |
image_base64 = base64.b64encode(buf.read()).decode('utf-8')
|
115 |
buf.close()
|
116 |
|
117 |
+
return result, f'<img src="data:image/png;base64,{image_base64}" />'
|
118 |
|
119 |
except Exception as e:
|
120 |
return {"error": str(e)}, ""
|
|
|
123 |
demo = gr.Interface(
|
124 |
fn=analyze_dna,
|
125 |
inputs=[gr.Textbox(label="DNA Sequence"), gr.Textbox(label="Password", type="password")],
|
126 |
+
outputs=["json", "html"]
|
127 |
)
|
128 |
|
129 |
# Launch the interface
|