-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapp.py
52 lines (46 loc) · 1.44 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import gradio as gr
from pipeline.extract import zero_shot_generate
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
input_textbox = gr.Textbox(
lines=10,
label="Input Text",
)
ontology_dropdown = gr.Dropdown(
choices=[
"https://schema.org",
],
label="Ontology",
)
llm_dropdown = gr.Dropdown(
choices=[
("Llama 3.1 8B", "llama3.1:latest"),
("Llama 3.2 3B", "llama3.2:latest"),
],
label="LLM",
)
output_format_dropdown = gr.Dropdown(
choices=[
("Turtle", "turtle"),
("RDF/XML", "xml"),
("JSON-LD", "json-ld"),
("N-Triples", "ntriples"),
("Notation-3", "n3"),
],
label="Output Graph Format",
)
btn = gr.Button(
value="Generate",
)
output_textbox = gr.Code(
lines=40,
label="Knowledge Graph",
)
btn.click(
fn=zero_shot_generate,
inputs=[input_textbox, llm_dropdown, ontology_dropdown, output_format_dropdown],
outputs=[output_textbox],
)
if __name__ == "__main__":
demo.launch()