Spaces:
Sleeping
Sleeping
saicharan2804
commited on
Commit
·
14684b8
1
Parent(s):
aabba08
Code changes
Browse files- app.py +67 -0
- requirements.txt +6 -0
app.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import evaluate
|
2 |
+
from evaluate.utils import launch_gradio_widget
|
3 |
+
import gradio as gr
|
4 |
+
# from pathlib import Path
|
5 |
+
# import sys
|
6 |
+
# import os
|
7 |
+
|
8 |
+
# from .logging import get_logger
|
9 |
+
# logger = get_logger(__name__)
|
10 |
+
|
11 |
+
# ###
|
12 |
+
# def launch_gradio_widget(metric):
|
13 |
+
# """Launches `metric` widget with Gradio."""
|
14 |
+
|
15 |
+
# try:
|
16 |
+
# import gradio as gr
|
17 |
+
# except ImportError as error:
|
18 |
+
# logger.error("To create a metric widget with Gradio make sure gradio is installed.")
|
19 |
+
# raise error
|
20 |
+
|
21 |
+
# local_path = Path(sys.path[0])
|
22 |
+
# # if there are several input types, use first as default.
|
23 |
+
# if isinstance(metric.features, list):
|
24 |
+
# (feature_names, feature_types) = zip(*metric.features[0].items())
|
25 |
+
# else:
|
26 |
+
# (feature_names, feature_types) = zip(*metric.features.items())
|
27 |
+
# gradio_input_types = infer_gradio_input_types(feature_types)
|
28 |
+
|
29 |
+
# def compute(data):
|
30 |
+
# return metric.compute(**parse_gradio_data(data, gradio_input_types))
|
31 |
+
|
32 |
+
# iface = gr.Interface(
|
33 |
+
# fn=compute,
|
34 |
+
# inputs=gr.Dataframe(
|
35 |
+
# headers=feature_names,
|
36 |
+
# col_count=len(feature_names),
|
37 |
+
# row_count=1,
|
38 |
+
# datatype=json_to_string_type(gradio_input_types),
|
39 |
+
# ),
|
40 |
+
# outputs=gr.Textbox(label=metric.name),
|
41 |
+
# description=(
|
42 |
+
# metric.info.description + "\nIf this is a text-based metric, make sure to wrap you input in double quotes."
|
43 |
+
# " Alternatively you can use a JSON-formatted list as input."
|
44 |
+
# ),
|
45 |
+
# title=f"Metric: {metric.name}",
|
46 |
+
# article=parse_readme(local_path / "README.md"),
|
47 |
+
# # TODO: load test cases and use them to populate examples
|
48 |
+
# # examples=[parse_test_cases(test_cases, feature_names, gradio_input_types)]
|
49 |
+
# )
|
50 |
+
|
51 |
+
# iface.launch()
|
52 |
+
# ###
|
53 |
+
|
54 |
+
|
55 |
+
module = evaluate.load("saicharan2804/molgenevalmetric")
|
56 |
+
# launch_gradio_widget(module)
|
57 |
+
|
58 |
+
iface = gr.Interface(
|
59 |
+
fn = module,
|
60 |
+
inputs=[
|
61 |
+
gr.File(label="Generated SMILES"),
|
62 |
+
gr.File(label="Training Data", value=None),
|
63 |
+
],
|
64 |
+
outputs="text"
|
65 |
+
)
|
66 |
+
|
67 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
evaluate
|
2 |
+
rdkit
|
3 |
+
molsets
|
4 |
+
pandas==1.5.3
|
5 |
+
gradio==3.43.1
|
6 |
+
PyTDC
|