Spaces:
Running
Running
Simon Dürr
commited on
Commit
•
bebad14
1
Parent(s):
dffaf30
basic template
Browse files- Dockerfile +2 -2
- app.py +0 -6
- inference_app.py +36 -3
Dockerfile
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
FROM continuumio/miniconda3
|
2 |
|
3 |
WORKDIR /usr/src/app
|
4 |
-
RUN python -v
|
5 |
-
RUN mkdir /usr/src/app/flagged
|
6 |
COPY . .
|
|
|
|
|
7 |
RUN pip install --no-cache-dir -r requirements.txt
|
8 |
EXPOSE 7860
|
9 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
|
|
1 |
FROM continuumio/miniconda3
|
2 |
|
3 |
WORKDIR /usr/src/app
|
|
|
|
|
4 |
COPY . .
|
5 |
+
# install dependcies
|
6 |
+
RUN conda install -y pandas numpy scikit-learn
|
7 |
RUN pip install --no-cache-dir -r requirements.txt
|
8 |
EXPOSE 7860
|
9 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
app.py
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
|
3 |
-
def greet(name):
|
4 |
-
return f"Hello {name}!"
|
5 |
-
|
6 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inference_app.py
CHANGED
@@ -1,6 +1,39 @@
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
|
|
1 |
+
|
2 |
+
import time
|
3 |
+
|
4 |
import gradio as gr
|
5 |
|
6 |
+
from gradio_molecule3d import Molecule3D
|
7 |
+
|
8 |
+
|
9 |
+
def predict (input_sequence, input_ligand):
|
10 |
+
start_time = time.time()
|
11 |
+
# Do inference here
|
12 |
+
# return an output directory
|
13 |
+
end_time = time.time()
|
14 |
+
run_time = end_time - start_time
|
15 |
+
return None, run_time
|
16 |
+
|
17 |
+
with gr.Blocks as app:
|
18 |
+
|
19 |
+
gr.Markdown("# Template for inference")
|
20 |
+
|
21 |
+
gr.Markdown("Title, description, and other information about the model")
|
22 |
+
with gr.Row():
|
23 |
+
input_sequence = gr.Textbox(lines=3, label="Input sequence")
|
24 |
+
input_ligand = gr.Textbox(lines=3, label="Input ligand SMILES")
|
25 |
+
|
26 |
+
# define any options here
|
27 |
+
|
28 |
+
# the final for inference should be the default options
|
29 |
+
# slider_option = gr.Slider(0,10, label="Slider Option")
|
30 |
+
# checkbox_option = gr.Checkbox(label="Checkbox Option")
|
31 |
+
# dropdown_option = gr.Dropdown(["Option 1", "Option 2", "Option 3"], label="Radio Option")
|
32 |
+
|
33 |
+
btn = gr.Button(label="Run Inference")
|
34 |
+
out = gr.Molecule3D()
|
35 |
+
run_time = gr.Textbox(label="Runtime")
|
36 |
+
|
37 |
+
btn.click(predict, inputs=[input_sequence, input_ligand], outputs=[out, run_time])
|
38 |
|
39 |
+
app.launch()
|