Spaces:
Sleeping
Sleeping
lfs style
Browse files- .gitattributes +1 -0
- app.py +35 -55
- huggingface.ttl +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.ttl filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,63 +1,43 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
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 |
-
token = message.choices[0].delta.content
|
38 |
-
|
39 |
-
response += token
|
40 |
-
yield response
|
41 |
|
|
|
|
|
42 |
|
43 |
-
"""
|
44 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
45 |
-
"""
|
46 |
-
demo = gr.ChatInterface(
|
47 |
-
respond,
|
48 |
-
additional_inputs=[
|
49 |
-
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
50 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
51 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
52 |
-
gr.Slider(
|
53 |
-
minimum=0.1,
|
54 |
-
maximum=1.0,
|
55 |
-
value=0.95,
|
56 |
-
step=0.05,
|
57 |
-
label="Top-p (nucleus sampling)",
|
58 |
-
),
|
59 |
-
],
|
60 |
-
)
|
61 |
|
62 |
|
63 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
import rdflib
|
4 |
|
5 |
+
import gradio as gr
|
6 |
+
import rdflib
|
7 |
+
|
8 |
+
# Load the Turtle file and initialize the graph
|
9 |
+
g = rdflib.Graph()
|
10 |
+
g.parse('huggingface.ttl')
|
11 |
+
|
12 |
+
# Define the function to execute the SPARQL query
|
13 |
+
def run_sparql(query):
|
14 |
+
try:
|
15 |
+
qres = g.query(query)
|
16 |
+
results = []
|
17 |
+
for row in qres:
|
18 |
+
# Concatenate each row's results into a readable string
|
19 |
+
result = " | ".join(str(cell) for cell in row)
|
20 |
+
results.append(result)
|
21 |
+
return "\n".join(results) if results else "No results found."
|
22 |
+
except Exception as e:
|
23 |
+
return f"Error: {e}"
|
24 |
+
|
25 |
+
# Gradio interface
|
26 |
+
query_input = gr.Textbox(label="SPARQL Query", lines=5, placeholder="Enter your SPARQL query here")
|
27 |
+
output_text = gr.Textbox(label="Query Results", lines=10)
|
28 |
+
|
29 |
+
# Launch the app
|
30 |
+
demo = gr.Interface(
|
31 |
+
fn=run_sparql,
|
32 |
+
inputs=query_input,
|
33 |
+
outputs=output_text,
|
34 |
+
title="SPARQL Query Interface",
|
35 |
+
description="Enter a SPARQL query to retrieve data from the Turtle file.",
|
36 |
+
)
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
if __name__ == "__main__":
|
39 |
+
demo.launch()
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
|
43 |
if __name__ == "__main__":
|
huggingface.ttl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b427f632d71c69ffc8a820689d3ffc0ecd764aa9af7920b57c69afb3c366655f
|
3 |
+
size 22698390
|