Spaces:
Sleeping
Sleeping
Commit
·
b44dadb
1
Parent(s):
015af8d
Update app.py
Browse files
app.py
CHANGED
@@ -134,25 +134,32 @@ def generate_knowledge_graph(api_key, user_input):
|
|
134 |
title_and_description = """
|
135 |
# Instagraph - Knowledge Graph Generator
|
136 |
|
137 |
-
This interactive knowledge graph generator is inspired by [this GitHub project](https://github.com/yoheinakajima/instagraph/).
|
138 |
-
|
139 |
Enter your OpenAI API Key and a question, and let the AI create a detailed knowledge graph for you.
|
140 |
|
141 |
-
You can input a URL to scrape text for generating the knowledge graph. Rest assured, the code is open for your inspection to ensure safety.
|
142 |
"""
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
gr.
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
# Enable queueing system for multiple users
|
157 |
-
|
158 |
-
|
|
|
|
|
|
134 |
title_and_description = """
|
135 |
# Instagraph - Knowledge Graph Generator
|
136 |
|
|
|
|
|
137 |
Enter your OpenAI API Key and a question, and let the AI create a detailed knowledge graph for you.
|
138 |
|
139 |
+
**New Feature:** You can now input a URL to scrape text for generating the knowledge graph. Rest assured, the code is open for your inspection to ensure safety.
|
140 |
"""
|
141 |
|
142 |
+
with gr.Blocks() as app:
|
143 |
+
gr.Markdown(title_and_description)
|
144 |
+
|
145 |
+
with gr.Row():
|
146 |
+
with gr.Column():
|
147 |
+
result_image = gr.Image(type="pil", label="Generated Knowledge Graph")
|
148 |
+
|
149 |
+
with gr.Row():
|
150 |
+
with gr.Column():
|
151 |
+
api_key = gr.Textbox(label="OpenAI API Key", type="password")
|
152 |
+
user_input = gr.Textbox(label="User Input for Graph or URL", type="text")
|
153 |
+
run_btn = gr.Button("Generate")
|
154 |
+
|
155 |
+
run_btn.click(
|
156 |
+
generate_knowledge_graph,
|
157 |
+
inputs=[api_key, user_input],
|
158 |
+
outputs=[result_image]
|
159 |
+
)
|
160 |
|
161 |
# Enable queueing system for multiple users
|
162 |
+
app.queue(concurrency_count=10)
|
163 |
+
|
164 |
+
print("Iniciando a interface Gradio...")
|
165 |
+
app.launch()
|